It's true that stocks in the US in the 20th century dramatically outperformed that 3%. This is for three reasons: first, up to about 1975, the world's economic growth rate was higher than 3%, due to the Second Industrial Revolution; second, up to about 1975, the US's economic growth rate was even higher than the world's, because it was taking over the markets previously supplied by the bombed-out economies of Europe (especially the UK) and Japan. Third, since about 1970, the share of economic output that went to owners of capital (rather than labor) increased dramatically.
Now, the third of those things probably can't happen again, because capital's share of output is already super high. (It's not that it can't get higher, but it can't go past 100%.) The second could happen again, but if it does, the US will be in the position of the UK, Japan, or Germany — it's now the Single Superpower (not even a mere Great Power) who could lose market share, probably to China or to a non-nation-state power. Investors in Japan's and Germany's stock markets in 1925 or 1935 didn't do so well.
The first, well, that's anyone's guess. It's a total wildcard.
It's certainly reasonable to posit a Third Industrial Revolution, made out of some of free software, nanobots, biotech, abundant solar energy, AI, and automated fabrication. I sure hope we get one. But if we do, it's not at all obvious who the returns will flow to. (Everyone, I hope, not just shareholders.) Accumulating capital goods, as we've been doing for three million years, is less important when your capital stock can double every 24 hours through self-replication. Breweries do not account for the quantity of yeast they have on hand as a durable capital asset.
And it seems equally plausible that we'll instead experience a new Bronze Age Collapse or Decline and Fall, as inexpensive DIY drones, very affordable precision projectiles, anonymous markets in assassination, and ubiquitous retail surveillance provide a decisive advantage for attackers over defenders in the physical world, just as their software counterparts have on the internet.