Mixed up in all of this, especially in Europe, has to be the decline in birth rate (to native stock) (which at least in part stems from a loss of serious, demanding religion). As has been observed (Mark Steyn among others), how do you convince a retired childless couple that their government benefits should be cut for the future benefit of unrelated future generations of countrymen? The US birthrate is higher than Europe’s but the concept is the same. Along the same lines is the decline of the family, by which perceived obligations to future generations are also strained.
I would say post-industrial economics, a radically declining infant mortality rate, and increased life spans have a lot more to do with the declining birth rate than a decline in religiosity. Having large numbers of children simply isn’t economically feasible or desirable in a modern economy - you can’t put them to work (it’s illegal and their labor isn’t worth much anyway), and it is very expensive to raise them for 20 years with a high standard of living and with the degree of education required by our economy.
Having large numbers of children in the West is almost always subsidized by the welfare state. That means it probably isn’t rational behavior for our society - not unless you’d rather go back to an economy where most of us do menial work in factories and on farms.