There is plenty of land and housing in most places outside these cities.
There are two solutions. The individual solution is to go to these cities, get what you want, then leave and settle somewhere more reasonably priced. In some cases you might be able to skip this step if you're in a field that allows telework. I would personally recommend: once you career is established enough that you can get a good job in lots of places, don't stay in these cities unless you can comfortably afford housing. Comfortably means ideally 30% of your income goes to housing. If you stretch and spend absurd percentages of your income on housing you'll be house-poor and will never be able to accumulate wealth. It's even worse if you are renting or on a variable rate mortgage.
The collective/societal solution is that we need to massively increase the density of these cities and improve their infrastructure, but that will in many places require going to war against the NIMBY obstructionists.