I don’t think you’re wrong, but I think this might be over simplifying.
For one thing, in the USA, our building codes and standard methods for making apartments makes it very difficult and space inefficient to make apartments with enough bedrooms for families. Affording a SFH is only so desirable because there aren’t apartments big enough for families to grow into, and while moving to a rural area might allow for enough living space, now the family has to figure out how to have a job that supports them.
For another, we don’t make as many apartment-like buildings you can own part of. This deincentivizes staying in apartments, because with the way our real estate economy is structured, owning any real property is one of the best ways to secure a spot in the middle class.
Another aspect-- a lot of desirable places to live have populations that literally and directly state they don’t want to build more dense housing, they don’t want people who can’t afford the sfhs to live there. It’s not just about pricing people out of homeownership, it’s literally trying to gatekeep access to specific towns by class. Plenty of people would gladly accept living there even without SFHs, so the housing shortage is not caused by the people who want houses, and is instead caused by the people who don’t want apartments next to their houses.