One of the powers that sovereign nations have is to make treaties with other sovereign nations, these can be bi-lateral (as in the example you cite) or multi-lateral (like the Maastricht Treaty that binds the EU together). Once a treaty is agreed and signed it needs to be ratified by each country which makes it part of the domestic law in that country: for your example, if India breaches the treaty it can be taken to court under the laws and in the courts of India or Pakistan.
Treaties may have a sunset date and almost always have dispute resolution clauses, often requiring international mediation or arbitration. They may also have termination clauses like article 50 of the EU treaty (the "Brexit" clause).
One of the legal fictions of the doctrine of sovereignty is that nations are indissoluble and eternal. In practice, nations come and go (albeit rarely) and while this has legal consequences the process is actually extra-legal, always political and often martial. The worlds newest nation is, I believe, South Sudan, and one that has recently vanished is Yugoslavia.
Laws are not contracts: contracts require consent of the parties, among other things., laws don't, they are imposed irrespective of consent.