It is really not that murky; you pay tax on dividend or distribution from the Corp to the shareholder; it is deducted by the Corp from the dividend or distribution at the time it is paid. That is very simple and it follows the basic tax maxim of levying the tax when the money is paid.
Where the Corp retains earnings and does not pay a dividend or distribute earnings the tax is deferred. This allows efficient reinvestment of profit, pre-tax, back into the enterprise in order to increase productivity and grow the business without total reliance on debt financing.
To avoid abuse of Corps never paying a dividend or distribution of earnings, you require the Corp to justify the retention of earnings for a business purpose or investment, acquisition or payment of debt; not share buy backs. You also put a ceiling on how much debt a corporation is allowed to expense; so that excess leverage is not deductible.
Understand that capital investment of retained profit into the business or in the acquisition of another business creates taxable events in and of itself.
Clearly, this approach is not going to be favored by the finance industry which has made massive profits by leveraging corporate cash flows; this type of policy would discourage that kind of leveraging.