Housing is more "consumption" or "speculation" than "investment", since a house generates a negative cash flow. What defines an investment is generally expected future positive cash flow.
What makes most house buying decisions speculative is how the market price is justified. And today the "residual value" (value of the asset when you sell it) dominates buying decisions. This is defined as speculation (in future market price).
Without residual value, the market for old houses would be like the market for old cars or bicycles.
Imagine if government legislation enabled lenders to lend random amounts with old cars as security: it would put a price floor on second hand cars. Since second hand cars are of limited supply, and ownership of such a car enables you to borrow at minimal rate, therefore the market price of an old car becomes the value of the getting that loan.