This is why growth stocks like tech have taken more of a beating than value stocks like food, oil, or defense. The former rely heavily on the expectation of future cash flows, often far off in the future, and if there's an incidence of extremely high interest rates between now and then, the value of those cash flows is significantly reduced even if their absolute amount increases because of inflation.
If the Fed does not raise rates or is unable to control inflation, then it behaves as you describe: stocks become much more attractive than cash, and the rational price point for a stock becomes infinite. This is how the stock markets in Venezuela and Zimbabwe have behaved: they increase exponentially, measured in their native currencies, as the currencies depreciate exponentially.
In other words, investors are pricing in rate hikes in response to inflation, and assuming that this will be "controlled" inflation that raises price levels a finite amount and then disappears. If either of these assumptions proves to be false, stocks are significantly undervalued.