You're forgetting that there is a long, long history of proxy and semi-proxy wars over the last hundred years.
If China invades Taiwan (the only vaguely feasible flashpoint), and start getting their asses kicked, then they have two options:
1. Accept the loss, and survive as a nation.
2. Go nuclear, and stop existing as a nation.
Keep in mind, the number of nuclear weapons they have that can even reach the USA is extremely limited, something like 2-3 dozen, and after you account for communist industrial technology failure and every damn interceptor the USA can throw at those missiles, maybe half that will hit. Most likely all along the western seaboard, possibly Washington and NY taking hits, though with the sheer amount of defensive depth available there, that's unlikely.
The US would be hurt, but in exchange, China could be taking hundreds of nuclear hits from us. Any nuclear exchange that they start, will by definition be a losing one for them.
That doesn't mean it's impossible they'll actually do so, just that it is the madness option.