Fix template nesting where end was unreachable

 * The transclusion start was being set to its parent node without
   altering the end similarly. This resulted in an unreachable end when
   searching siblings..

 * From a weird scenario when rt'ing enwiki/Suquamish_(motor_vessel)

 * Starts an outline of what's going on in the template wrapper. But
   I'll defer to Subbu here.

 * Cleans up a few minor things found when reading the code.

Bug: 63790
Change-Id: Ia29b3bfffea4a619f05e18f0d7933084441014d6
Merge "Fix template nesting where end was unreachable"