While the earnings of equities are somewhat protected against inflation (much like real estate due to higher rents), what you’re ignoring is the negative impact that inflation has on the valuation placed on equities (and real estate) because the discount rate applied to the cashflows increases. So, your earnings may increase but your valuation will probably still decline.
To use your example, in the first instance the discount rate applied to the $10 in profit might be, say, the professorial 10%, comprised of 3% inflation and a 7% risk premium, for a value of $100.
In the second instance the discount rate applied to the $12 in profit might be 27% (20% inflation plus a 7% risk premium), for a value of $44.44.
So your earnings go up, but your valuation declines. So, your cashflow increases but your principal declines… so you’re not really protected are you?