Recall that Taiwan only exists because during the Chinese civil war, the United States provided the KMT with billions of dollars of military and financial aid. The KMT lost the mainland to the CCP (supported by the Soviets) and fled to Taiwan. The U.S. provided $4 billion dollars of aid, worth approximately $50 billion today.
The PRC would have retaken Taiwan decades ago if not for the U.S. guaranteeing Taiwan.
How does Taiwan "switch allies" to the adversary that's trying to annex them?
To answer your question perhaps one way could be for China to put forward a long term map to recognize the KMT as a party and unify as one China may years in the future. I would guess it would take a generation or even two to pass before that might happen and China would have to make the case that the people of Taiwan would be better off with the mainland rather than independent of it.