Building a “backup factory” would also require that massive investment every year to revamp the assembly line, and never get used.
Then there’s the thousands of components that go into an iPhone, and their deliver schedules perfected down to 30 minute windows - you’d have to recreate that, and just ship, what, nothing? To the backup factory?
You build four large factories instead of one mega factory and run all four. Similar number of machines, similar investment to update them - each is big enough for efficiencies of scale - but if one gets shut down by the local government or has a massive fire or there's a coup you've still got 3/4 of your production going.
During the pandemic one of the only car companies that didn’t have major disruption was Toyota and they were the pioneers of this model of operating but they also understood the need to keep reserves of critical components.
In the case of Apple, they do have a backup plan - the lower end models were already being manufactured outside China and they could scale that up while they scramble to fix the Pro lines.
[1] https://www.amazon.com/Goal-Process-Ongoing-Improvement/dp/0...