This headline of The Times (London) of today is catchy but misleading, since the study it refers to is about whole societies, not individual wealth.
Here is the abstract of this study ("Religious change preceded economic change in the 20th century" ):
"The decline in the everyday importance of religion with economic development is a well-known correlation, but which phenomenon comes first? Using unsupervised factor analysis and a birth cohort approach to create a retrospective time series, we present 100-year time series of secularization in different nations, derived from recent global values surveys, which we compare by decade to historical gross domestic product figures in those nations. We find evidence that a rise in secularization generally has preceded economic growth over the past century. Our multilevel, time-lagged regressions also indicate that tolerance for individual rights predicted 20th century economic growth even better than secularization. These findings hold when we control for education and shared cultural heritage." - -
What is important to understand that the sequence they found does not imply causation. It would be erroneous to conclude that secularization caused economic growth; there may a third factor that may act in the background (like, say, a shift towards more individualistic values)
source: [advances.sciencemag.org]
I agree with your last paragraph. I think that as societies modernized people moved from farms to cities. That alone would have an effect on church attendance. Often churches in small rural places serve as important social centers as well as dispensers of religious messages, but cities have other venues.
It's still a very interesting topic to consider. Thank you for sharing!