SI-8893 Restore linear perf in TailCalls with nested matches

Details in the individual commits. The one with SI-8893 in the commit
title offers the biggest win.

I'd ask for some help from the kindly reviewer to understand why
that fixed exponential performance, rather than just giving
a constant factor speedup.

Review by @adriaanm