I think it should almost only be seen as an investment. Like any sizeable investment, a lot of calculation should be made to decide if it makes sense or not. (And spoiler alert, in most places in California it does not make any sense anymore)
Buying a home is extremely emotional and I'm actually shocked to see how few homeowner actually even calculated the opportunity cost of buying a home vs renting and investing the downpayment. Or even calculated anything at all. Never forget there is a huge lobby of people that want you to buy a home. (agents, banks, realtor, people that already own a home, ...)
I think there is that emotional bias to absolutely want to buy a home, mixed with the fact that people think they will get the same +200% returns that you see since 2012 in the bay area.
(Please don't respond with the typical "Paying rent is like throwing money out of the window")
As a reference, a blog post on this subject that I mostly agree with: https://medium.com/@usaar33/why-you-shouldnt-buy-a-home-in-t...