That's a highly idealized view that I hope we can agree doesn't completely jive with what we see in society today. If a small number of shareholders reap all the profits, the vast majority of the benefit from automation flows to them, and it's even possible for the lives of average people to get worse as automation increases, as average people then have less leverage over those who own the companies.
On average, most large cap stocks (MSFT, GOOG, AAPL, etc) are owned by millions of retail investors through 401Ks, mutual funds, ETFs, and direct ownership.
> If a small number of shareholders reap all the profits
It's not greater profits but lower costs (and prices) that matter here.
Everybody can be a shareholder in a publicly traded company. It's pretty easy.
If you want to spin up some conspiracy theory about elites snatching up productivity gains, you should focus on top managers.
(Though honestly, it's mostly just land. The share of GDP going to capital has been roughly steady over the decade. The share going to land has increased slightly at the cost of the labour share.
The labour share itself has seen some shake up in its distribution. But that doesn't involve shareholders.)
Inflation adjusted incomes are up in the US across the board. The affordability problem is largely the price of housing because it's illegal to build.