I used to think the same way you did until very recently. But you're (we're) forgetting happens to that cash that *doesn't* get paid out to shareholders. It gets retained on the balance sheet as cash or other investments, and makes the company worth more. Therefore it's valuation is higher, which warrants a higher stock price.
Take two companies: A and B. Both companies are in the same industry, have identical growth, sales, operating margins, etc...the only difference is that A has $10B cash on its balance sheet and B has none. If you were to outright purchase the company (i.e. buy all of its assets), which would you pay a higher price for? Also: Which company is more likely to fare better during an economic downturn?
Marriage is the sole cause of divorce.