There's currently much more money to be gained from attracting investment than there is from generating profit, so companies that don't prioritise selling to investors over selling to customers just won't get as big, and the feedback loop ensures that investors who invest in things that other investors will invest in later will have more money to reinvest later than investors who invest in companies that can make a profit. Historically, investors who invested in companies that couldn't become profitable lost their money, so couldn't invest in other things in the future. The system kind of does do what it's intended to, and efficiently allocate capital to where it generates the most return, but that's become decoupled from the implicit goal of most effectively providing goods and services.
If I had to guess at the root cause, a good candidate would be that after the 2008 financial crisis, when quantitative easing was (successfully) used to stop nearly everyone losing their livelihoods by ensuring investors had access to enough money to avoid feeling pressure to pull out of all their sane investments and in doing so collapse all major employers, because it was never undone through quantitative tightening, there was enough excess money sloshing around afterwards that investors could afford to risk investing in dumb shit, and dumb shit could attract enough follow-up investment later that the early investors were rewarded.
