When you buy a small house for $800k in the bay area versus a $200k home in a rural part of another state, it doesn't mean you need 4x the salary. It means you need 2x the income (spouse would have to work) and take out a bigger loan. Bigger loan means you build equity up slower because most of your mortgage payments go towards the interest (really, it gets ugly for any loan over $400k). But you aren't expected to pay off the house, that's not really the goal. You're expected to sell the house and apply your equity to a new house. (perhaps retire somewhere cheap and pocket the difference)
The advantage for me is a nice metropolitan area with a low population density (it covers a large area).
There are places to live in the bay area for sub-$400k that are regular middle class neighborhoods. They aren't up near all the trendy shops and have only an average school system. Using the 28% of your income rule and $135k/yr salary after income tax it looks like you one could afford around $2200/mo which is about what you'd need for a $350k 30-year loan plus property tax that you'd have on a $400k house. (sorry if my math is not exact to the latest rates, these are ballpark numbers here). $135k/year is not unusual in the bay area for a single engineer or for a couple with a two income household (ex: teacher + building contractor).