Apple is big enough and rich enough that they don't need Chinese manufacturing. It is a nicety, and probably cheaper, but they could have probably picked about any country to do it and set up shop. As pointed out, Samsung does all their mfg in Korea and Vietnam. Oneplus setup shop in India for some devices...and Apple is much more powerful than BBK.
I'm sure China knows that if they do ever actually invade Taiwan, then there will be hundreds of agents, if not outright military actions, to destroy or sabotage the critical parts of Taiwanese industry rather than let them fall into the hands of the CCP. (For instance, I can't imagine any of the key ASML machines would survive without being quite thoroughly destroyed by thermite to keep their secrets from falling into Chinese hands.)
This would nearly completely cripple the world's tech economy for a decade, but that is far better then becoming vassals to CCP tyranny.