No RAM, no profits. Apple has vertically integrated in the past for less reason than this.

Moreover it's a massive economy of scale, while their consumer electronics competitors are busy fighting a losing battle against the server market for chips, Apple can undercut them, grow their market share and get even more service revenue.

RAM prices surging in the AI hype era does not mean they'll stay there for decades (see xAI already letting one data center go), and it would take a long time for Apple to become competitive.

Should they also start CPU fabs? Batteries? Lithium mines?

The risks are not symmetric. If the RAM crisis becomes the new normal it threatens Apple's business model which requires large quantities of RAM.

On the other hand, if Apple invests in RAM production and prices fall, it's not like the investment is wasted, RAM is a commodity. They lose at worst the opportunity cost of deploying the capital inefficiently, but they have so much that it hardly matters.

Apple should take this crisis as a warning that they aren't vertically integrated enough to protect their business model.

As for batteries, Apple is not even close to the largest consumer of batteries. If they were an electric car company then yes they should be making their own batteries.