It makes much more sense when you realize it’s far from the only time the US does something that doesn’t make sense, in the assumption that the US is a single, concrete entity having a sense of self-interest. It’s just that the assumption itself is false.
Rather, it’s lots of different, concrete individuals in an abstract, collectivist group. Each individual of the collective has an interest in plundering the collective for personal gains. That’s notably how wars are incentivizing lots of public money to fall into private hands, despite the fact it costs a lot to the collective.
In strategy modelling, it makes sense trading with as many people as possible as long as each trade or group of trade is profitable to you (you can even accept a unprofitable trade that allows you to access a more profitable trade). And it makes sense never participating in conflicts and letting your opponents take most of the conflicts for themselves, with most of the losses, unless if some conflict clearly puts someone as a winner takes all. But that is the case for these scenarii only as long as each individual has no personal interest besides the collective it represents.