For ENG-3982 fix dependency handling for plan fragments in SnapshotRestore

This is apparently dependency handling code that existed in TxnState already, but that is 2.0 code. In 3.0 it is necessary for SnapshotRestore.
For ENG-4277, backport ENG-3982 to 2.8.4.2