Is there any precedent for what happens when entire countries and jurisdictions where contracts were made cease to exist?
I cannot answer from a historical perspective. From a legal standpoint, though, the contract ought to be enforced in accordance with the parties' intent and knowledge that can be inferred from when the contract was formed. The original laws constitute material part of the context in which the contract was formed, and therefore they might be indicative of parties' underlying intent. Accordingly, the old laws would be adopted.
This is a form of contractual choice of law. As such, it cannot be stricken merely on grounds that unexpectedly the chosen legislation no longer exists.
Even if there were an actual/historical ruling in the opposite direction, it would be odd to the extent that it hinders the contract law tenet that a contracts are entered knowingly and willfully. In other words, it would be a ruling or precedent which contravenes a legal principle that is more important. Said tenet is very common among "modern" legal systems, encompassing both common law and civil law.
The main exception would be if the outcome of the aforementioned approach contravened public policy of the substitute jurisdiction. In that case, the laws of the substitute jurisdiction would supersede the original ones.