When you sign a contract with a supplier in a foreign country, read the fine print and check the jurisdiction.
Like a great many of your questions, this reads as if you expect the world community to function like a super-state, with laws and rules which the individual nations have to obey. But nations are sovereign, and they stay sovereign until another nation or coalition of nations forces a change.
There is a price to pay when nations abuse their sovereign powers to hurt foreign investors, notably bilateral and multilateral investment protection treaties. Violating those will cut a country off from foreign investment, not make it less sovereign. In an extreme case, look at the US use of SWIFT against Iran and others. Iran is hurting, but it cannot make the US to allow them into SWIFT.
So as to your question:
- The US did find it politically advisable to stop the transfer of aircraft, and they didn't find it advisable to make their defense industry return the money.
- The US did not take a significant reputation loss on international markets for that action because important market actors were willing to go along.
- The US defense industry does take a slight reputation loss with some international customers for human-rights-based and political interference in contracts. Other suppliers like Russia are seen as less likely to make a point about internal policies of the customers.
It wasn't a threat with a lawsuit which got Pakistan the money back. It was the changing political climate in both the US and Pakistan. As to Turkey, there was a quite complex deal involving Turkey supplying parts that would go into the F-35, and also subsidizing part of the development cost. You don't buy yet fighters like you buy standard civilian cars.