The stock market itself isn’t the problem either though, it’s that the wealthy have money and the poor do not. If you want to buy a house and you don’t have the cash for it, you need to borrow from someone…and that means someone who has a lot of money. And you’ll pay interest for the privilege because there is a time value of money. That doesn’t go away without a stock market.
The real solution is to tax the wealth itself, either directly or through taxing the step-up in value after the owner of a stock dies, or a massively increased estate tax.