Plus then since the future is unknowable, it's tied up with investor's personal risk profiles, discount factors and some straight up sentimentality. If you have a crystal ball and can predict the future perfectly, stock prices would correlate with profits, but even if the market was perfect, current profits would be related to past stock prices, not current stock prices.
(Oh, and to make it more complicated and basically impossible to model with linear equations, if you own stock you can influence those future outcomes both directly via shareholder activism and indirectly via the effect you have on a company's cost of capital, so the whole system is dialectic.)
So the stock market allows you to take those risks and mitigate them in near-as-possible real time.
Perhaps not in the short term, but they definitely are in the long term.