That is totally fine that those countries agreed to it. The United States did not though. So any foreign court that attempts to prosecute Americans for how Americans act on American soil or in American jurisdiction (for example, by attempting to indict Americans carrying out the legal business of the United States), is a violation of American sovereignty.