You're forgetting that the price of any new owner-occupied property must also price-in the opportunity cost of not renting out that property. Nobody buys a house when they could get rich by renting out the same house to someone else. Indeed a foreign investor is likely to buy it, because it's a great source of income, and they already have somewhere to live.
If I can rent a property out for thousands of dollars a month, that property is worth a lot of money. So it's really the rental market that is pushing up prices in the owner-occupied market.
Lots of people buy real estate in can Vancouver and leave it empty instead of renting it out. It is a safe place to park money and the hassle and wear of tenants isn't worth the money they pay when the market has been going up so much.
I've heard there is a city in Australia that also has loads of empty condos bought by investors... Surfers maybe?
Buying a house and not living in it or renting it is definitely a thing
In the last housing bubble rents detached from housing prices pretty severely. Back in the 80s, it was generally cheaper to buy than rent - the 20% down saw to that. But things completely flipped with the more recent financial ingenuity.
In a way, I see rising rents in SF as a return to normalcy.
It might not be a huge factor but it's something to keep in mind.