Then again, I can't fathom what people would be doing with their money if the stock market weren't there. I imagine they might naturally wind up with some sort of...stock market.
As you point out, in practice what's efficient is what can capture the highest return, not necessarily the highest return per se. If say investing in education had high returns society wide but those returns couldn't be captured, that's not an efficient use of private capital.
And if so, why is that necessarily a good thing? Why should that be our goal as society as opposed to things like minimizing child mortality, increasing literacy rates, making sure we don't have a ton of our fellow humans living on the street in misery etc etc - things that make the lives of our fellow humans better? Why is capital growth the metric we have chosen to optimize for? Surely there's better things to optimize for?
Excuse the polemic, but infinite growth with no regard for anything else is the ideology of a cancer cell - and to me that is increasingly what it feels like when we are wasting all these resources on a dying planet just to make numbers go up.
There's a lot that's not captured by solely looking at dollars, like the examples that you bring up, such as quality of life, human welfare, and so on.
Number go up infinitely is due to inflation and that's basically just an incentive to not hoard cash indefinitely, and instead use it for something useful. But the only thing that uses up is numbers. Everything else is because people, on average, want more stuff and are willing and able to work hard to get it.
(Of course, this generally means that the markets chase the desires of those who have something valuable enough. People who don't will be marginalised by this mechanism, for sure. And of course there's lots of opportunity for people to steal or abuse powerful positions in the market to the detriment of others. Which is why a free market is not the be all and end all of organising a society, and other organisational structures exist to regulate it and to allocate resources in a less transactional manner)
I'd posit that markets are completely detached from the real world and are more of a speculative/religious element than an indicator of any ground truths.
Edit: I just realized I missed a sentence of yours where you kinda spoke to this. I still believe that this is more of a rule than an exception - there is nothing inherently tying markets and reality together - they're mostly about people making bets on what the next big hype is; not on what is actually useful to anyone.