It goes without saying that since 1971 the US has gone out of its way to remove any status Taiwan had to being an ally to be protected by the US. For the US China, after all, is given preference as much more import politically and more significant, economically.
So, in terms of a timeline:
1971 the UN removed Taiwan's status as a Permanent Member of the UN Security Council giving that status to China. At the same time Taiwan was expelled from the UN altogether.
also in 1971 Kissinger fundamentally changes US foreign policy towards China by secretly travelling to China to meet its leaders. Kissinger realised that China and the Soviets were not a monolithic bloc. The USSR could be, and was, isolated by the US and China enjoying closer relations.
1972 this was followed by Nixon openly travelling to China to cement relations.
January 1, 1979 the US switched diplomatic recognition from Taiwan to China. So the US Embassy was moved from Taipei to Beijing
later in 1979 Taiwan Relations Act of US Congress indicated the US would not necessarily defend Taiwan. Any defense is given strategic ambiguity. Instead "the United States will make available to Taiwan such defense articles and defense services in such quantity as may be necessary to enable Taiwan to maintain a sufficient self-defense capabilities". A weapon digression - for example this would appear to rule out the US organizing remote human triggered, or undersea sensor automatically triggered, land attack missiles to hit Chinese territory.
Although a second example USS Jimmy Carter and/or Orca XLUUVs pre-laying sensors-mine networks in waters some distance from Chinese naval bases, with such networks activated in time of war, in order to destroy Chinese submarines and surface vessels, may be a different matter.
A digression the USS Jimmy Carter follows a proud British tradition more than 100 years old. This specifically was in 1918 when a German submarine (UB-116) attempting to enter the UK Royal Navy Grand Fleet anchorage at Scapa Flow, was picked up by hydrophone and magnetic anomaly sensors that were interlaced with minefields. The British efficiently triggered mines around the submarine sinking it. All this has been written at Submarine Matters for alert scholars - see The long tradition of fixed ASW sensor and destruction arrays, dated April 4, 2016.
January 1, 1980 - returning to Taiwan. TheUS terminateditsMutual Defense Treatywith Taiwan that had been in force since 1955.
1980 All important US-China trade begins to rise sharply.
US-China relations fluctuate and may not always be bad. The US and China might return to closer relations that may again isolate Russia.
The US did not want to go to world war in 1953 when US and Chinese troops were actually fighting each other in Korea. The US would have even more to lose going to world war over Taiwan, because the Chinese military are much more powerful. Also China has nuclear weapons – all making China a potential “peer adversary”.
2021 - As Japan altered its tradional Defence White Paper wording, in 2021, now indicating "stabilizing the situation surrounding Taiwan is important for Japan’s security and the stability of the international community,”. Japan should seriously increase its defense budget to match its new thoughts and make improved precursors towards nuclear weapons. This could be along the lines South Korea is already doing - with South Korea's new 3,000+ tonne "KSS-3" submarine mounting 6 vertical launch cruise or ballistic missile silos. Later subs will have 10 silos.
Conclusion
So all the above indicates - however much some assume the US government might or should go to war with China over Taiwan, this is not grounded in US laws or policy.