The answer is always very much it depends, of course! And I'm in the process of purchasing a house myself, so I clearly don't think it's an insane decision.
It is, however, more complicated than the train of thought that says, "After 30 years, you'll own your own place, instead of having thrown away hundreds of thousands of dollars to a landlord."
It very much depends on where you live, and how the markets develop what pays off. But I'm very happy I bought.
If you buy your house as an investment, it's a big risk. If you buy it as a hedge, and intend to stay long term, it's generally pretty cheap insurance against getting priced out of the area you want to live in.