Housing cannot be both affordable
and and a good investment. The definition of a good investment is a piece of property that has a price that increases over time. The nature of exponential growth means that eventually housing will become unaffordable if it is perpetually a good investment.
Society's expectation that housing is a good investment results in people taking on significant debt to buy increasingly expensive homes. The consequence is that homeowners have a huge incentive to suppress the construction of additional housing, to inflate the values of their homes. And when housing prices do fall, people's financial lives are ruined. Contrast metros like SF, Portland, and Seattle with places like Tokyo where homes can be bought for < $400,000. A big part of this is that housing is expected to be a depreciating asset: https://www.youtube.com/watch?v=iGbC5j4pG9w