compiler: Use the correct plan in PlanTypeCheck

The pair type check was only using the top-level plan. This didn't seem
to break anything but it's clearly incorrect if branching occurs.

To catch this in the future make PlanWriter.buildCondBranch "seal"
itself when building branches and refuse to accept new steps in the
parent plan. This should help catch similar plan confusion in the
future.