Foxconn is Taiwanese, not Chinese. That's an essential distinction because neither the Taiwanese government nor their businessmen have any allegiance to the People's Republic of China. The fact that they've torn down a lot of barriers to travel and business is primarily due to opportunities for profit.
Taiwan still has a strong manufacturing base and like most other countries shifting manufacturing to China because it was cheaper. The fundamental driver, was cheap labor and overall lower cost of doing business. However, in many cases they retained the expertise for themselves, generally sending Taiwanese over to China to run the factories. This is in contrast to Americans who essentially outsource everything and then leave quality control and factory management in the hands of the locals.
This makes it much easier for Taiwanese to pull out and move their manufacturing elsewhere. They aren't stuck with this knowledge base in China they've invested in. Moving a factory isn't a big deal if there's a good case for it. It's relatively easy to train locals to work at your factory. However, engineers and managers with intimate knowledge of the process and all its nuances is much harder to replace.
The end result is that in the long run China is screwed. Unlike the Japanese, Koreans and Taiwanese, they're still a ways away from establishing their own technological base that enables them to not be reliant on manufacturing. The Taiwanese have had a harder time establishing their own brands, but they've practically cornered the market in high end manufacturing. Their companies are less likely to suffer a conflict of interest, unlike Samsung, and the stuff they make has a high degree of quality.