In contrast, if you go rob a grocery store, you can't just opt out of punishment. "I'm not a member of this court system" does not work as a viable defense strategy, even if some souvreign citizen types sometimes try (and always fail).
International treaties are really just statements of intent and can be withdrawn at any point. Worst that happens is that next time you try to make a treaty, your counterpart may not trust that you uphold your side of the deal. There is no higher authority to effecticely appeal to, in contrast to the grocery store case.