The NK situation was obviously widely known at the time, but that the US population/government didn't forsee or take seriously enough the rise of China is perplexing to some of its allies.
The idea of economically enforced peace only works for democratic countries where the government has to show at least a bare minimum of respect towards its citizens, but not in countries that follow the whims of their respective Dear Leader.
https://en.wikipedia.org/wiki/The_Great_Illusion
Wars are often irrational.
At the time international trade was still fairly minor, so although a war would be deeply unprofitable it'd still be possible. Today's economy looks quite different, with even basic consumer goods coming from overseas. If international trade were to suddenly cease, most major countries would be in serious trouble really quickly.
The most extreme example of this is the European Union. Its economies are so deeply interwoven that they act as a single entity. Separating them to the point that one of its members can independently support a war economy would take decades, so it does indeed make intra-European wars virtually impossible.
I don't think USA made any mistake. It was always heavily invested in South Korea and Taiwan. Neither of them would even exist today without USA's investment, interest, and stewardship.
Intel is the one that made the mistake.
Manufacturing chips of just TSMC accounts for 5% (!) of Taiwan's entire electricity consumption, Intel's Arizona fab produces thousands of tons of hazardous waste a year [1]. It's far from the old days, but still a massive impact.
[1] https://www.theguardian.com/environment/2021/sep/18/semicond...
The whole same story is going to play out again and in 20 years we'll be panicking because nobody in the US will know how to write software anymore.