Of course, I agree. I am not suggesting killing the real estate sector and I am not an economist, however I can give an example from my country. When you have gains through stocks like dividends you have around 30% tax on earnings while selling a house with profit is 22% on earnings. As a result there many more speculating in real estate than in the stock market.
That's not the main reason. The main reason is leverage: You don't pay in full when buying property, you get to use borrowed money. You pay in full buying stocks. By using leverage, the return on your actual invested capital is higher.
Of course it is also possible to buy stocks using leverage. But most markets have some regulatory control over letting retail investors trade in financial instruments using leverage, whereas buying property on leverage is a routine, normalized thing.