That's why American (and Japanese, and Korean, and British, etc.) companies contract work out. If the Chinese government decides to nationalize Apple's operations there, they'll get a few offices and several retail stores. If they nationalize Foxconn, there will be severe shortages while Apple tries to line up another contractor elsewhere; China, meanwhile, will simply be killing the golden-egg-laying goose.
Thanks to the Japan tsunami of late, Apple has learned to not rely on one supplier in one country for parts. IIRC they’re now outsourcing duplicate production to Brazil.
The affects the “make it in the USA” mantra (which, yes, I’m sympathetic to): a company that big wants redundant assurance that nothing - including sociopolitical events - disrupts production. They’ll manufacture in several countries just to ensure at least one line stays running.