That's the key. If you are looking at a horizon of 10 years or more, the stock market has always (with some rare exceptions) gone up. That is to say that if you take a random point in time, and look at the stock market 10 years later, you will have a very hard time finding a point where it didn't go up more than inflation.
If you do this exercise with shorter and shorter time frames, more and more points in time will show a negative return.
This was just a long-winded way of saying that I agree with you. Stock markets are good investments, but your horizon has to be long, and that means at least 10 years.