SI-8893 Restore linear perf in TailCalls with nested matches

Details in the individual commits. The last one is the main 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