I’m not sure I understand your position.
The logic of the stock market is that people constantly find ways of starting companies that build value and grow. That could be by digging resources out of the ground, making clothes, selling food, making weapons, the list is endless. Individually some of those companies will fail, but at the same time other people will spot opportunities and will start new companies that thrive and grow.
By investing in an index tracker you get to own a piece of a large swathe of those companies (which ones will depend on the type of tracker you choose). The individual failures are outweighed by the successes and the new starters because ultimately as long as there are people on earth, those people will have needs and wants that they are willing to pay to be satisfied. Companies, and stock markets, grow by successfully finding ways of fulfilling (or creating!) those needs and wants.
it sounds like your take on this is that the whole system will somehow collapse, but to realistically happen that is a sort of “end of days” scenario for humanity. At that point I think we’ll have much bigger problems than losing money on the stock market, so I don’t think I’d be prepared to bet on it - certainly not at the risk of losing out while the wealth grows.
One of the biggest issues I see is that the wealth that is being generated is concentrated in the hands of fewer and fewer people - hence why we now have billionaires and probably the worlds first trillionaire soon.
Ordinary people need to get some of these benefits too, and owning a stake in these companies is the only way that will happen. Keep your money as cash and you are standing on the sidelines watching the rich get even richer, leaving you further and further behind.