>people in ... Taiwan overwhelmingly consider themselves to be ... part of China
For those not familiar with the situation, Taiwan is the "Republic of China" as opposed to the "People's Republic of China". "China" in English is ambiguous as it could mean 中國, 中華民國, or 中華人民共和國 (usually meaning the last one nowadays). Both the ROC (中華民國) and PRC (中華人民共和國) claim to represent "China" (中國) according to their constitutions, but the PRC is the representative of "China" (中國) at the United Nations since 1971.
That wasn't the first Chinese invasion of Vietnam, though. The first time they stayed for a thousand years. (At least, that's how the Vietnamese tell it.)
Retreated immediately because they lost. It was even referred to as an embarrassment internally, and directly led to modernization of the PRC military.
Deng intended limited attack. And the incursion was limited.
>It was even referred to as an embarrassment internally
The theory was Deng, new in power intentionally wanted to embarrass powerful PLA brass to consolidate power. He was successful in that regard. It embarrassed the right people, by design.
>and directly led to modernization of the PRC military.
PLA modernization was in response to US stomping Iraq in Gulf War later. Anemic PLA was sufficient for Vietnam if they chose to press on with campaign. Poverty navy was enough for SCS against Vietnam (the other Sino-Vietnam war). Vietnam had very little influence on PLA modernization.
>because they lost
Categorical success in retrospect. PRC set back Vietnam development by 10+ years, forced CPV to dump resources into defense spending while wrecking enough of the country that Vietnam missed out on FDI that went straight to modernizing PRC. Current boom in Vietnam could have happened decade+ earlier during a period with greater potential to capitalize on offshoring before automation.
Common thread in these events is that PRC focused on / won political victories, i.e. war is merely the continuation of politics with other means. That said politics as alternative to war still realistically involves bullying.