We don't need economic theory for that it's just common sense. Humanity has been erecting structures to live in for approximately our entire existence. The modern economy is mechanized. How could a wood frame structure or a small high rise possibly be unaffordable if the market is functional?
Stop and think for a second. Someone in good health with a willingness to DIY and a sufficiently flexible schedule can literally build their own house from the ground up. It's a substantial time investment but not actually as much as you might think. Housing isn't very resource intensive compared to the rest of the modern economy.
The only possibilities I can imagine to explain unaffordable housing are broken regulations, critical levels of resource exhaustion, natural or man made disaster, and gross economic dysfunction.
The average person would need a MASSIVE investment in time to learn all the skills required in addition to investment in tools. Furthermore people won't lend joe random the funds required in the same fashion as they would for an actual finished house OR constructing a house via a contractor.
It's regulations. But before you call them broken, some of it is safety. Safety standards keep rising with technology and the economy as people can afford more. Same with cars. There's also zoning restrictions in some places designed to prevent slums by requiring large residences. I guess that's happening here too.