> A lot of this has to do with issues like zoning and building codes as well.
The general trend of richer countries having fewer babies holds even in countries with wildly different zoning laws and expectations around living conditions. Japan’s fertility rate fell below replacement a long time ago, and even countries like India and Mexico are now at or below replacement levels.
For any given material explanation one can point to, there are clear counterexamples of countries without that material problem which still has a low fertility rate.