Ultimately that money is made by people choosing to spend their money on something, because it helps them, because they like it, because they need it for whatever reason (real or imagined). That's what grounds the financial markets: eventually someone is buying a thing because they want the thing, and all the rest of it is basically just figuring out who can make the thing, how many people want the thing and how badly, and whether the stuff used to make the thing could make a different thing that people want more. Financial markets can depart from that reality for a while, but mainly because of a collective belief in some falsehood about the above (everyone really badly wants AI, right?).
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)
But isn't that counter to the very article we're commenting on? Everyone is shoving half baked AI junk into everything because that's what makes number go up on the stock market, but I'm pretty sure that's not actually what most people would want those resources to be used for.
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.