SI-8331 make sure type select & applied type doesn't match terms

Due to tree re-use it used to be the fact that type quasiquotes could
match term trees. This commit makes sure selections and applied type and
type applied are all non-overlapping between q and tq.
Address pull request feedback

1. Tighten up the if else to avoid duplication
2. Add doc comments