Yes, I understand your concern. The examples you use are good ones.
Over the years, I’ve seen numerous housing booms and busts. Generally, prices get pumped up based on the local economy, then the economy takes a hit and the housing prices drop (e.g., Detroit, Boston after the mini-computer companies collapsed). We were fortunate enough to buy our house during a bust, but I’ve seen the house value rise and fall several times.
I don’t know what’s going to happen to SF. As you said, the service workers are being priced out. I don’t know a good solution in this instance. At some point, the residents may be forced to cook for themselves or wash their own clothes. I have no idea how they’ll staff the schools, though, if teachers can’t afford to live there.