Avoid PHP warnings for break & continue
Our previous mechanism of doing a "lookbehind" with twig lead to array key notices/warnings. Instead we now look ahead, which is also valid from the perspective of twig, to determine if more loops are ending than closing, and for break if enough loops are ending to break out of.