> presumably China would still want to keep selling those products and would have an interest in avoiding destroying those factories
It has been hinted by people who might know something that Taiwan has rigged their factories to explode if China invades to ensure China can't get a hold of those factories. I'm not sure if it is true, but it wouldn't be hard to do (the hard part is ensuring the explosives don't go off for other reasons)
Not to mention the number of random individuals, with enough access, who might want to sabotage them in those circumstances. And fuck knows what the Trump administration decides to bomb. And the general fog of war. And how delicate everything is.
ASML can also disable much of the equipment remotely, from Europe. So even if the buildings aren't actually bombed (they likely would be though), someone presses a button a few thousand miles away and most of it gets bricked anyway.