Make housing affordable with denser mixed-use zoning: You solved 50% of the problem. Make public transport convenient. You solved another 30%. People needs to be able to stay frugal in rough times and socialize. It feels to me that many US cities make this impossible. If you had Spain levels of unemployment I have no idea how would you do.
If I read you correctly, the social fabric in spain (urban planning, gatherings) makes difficult times bearable ? I'm quite interested in this because I anticipate we'll all need this when climate becomes too dire.
This isn't the case anymore (price wisw, still dense) and it's having effects on the social fabric.