I haven’t had time to do more than skim, but I’m already boggling at the sheer amount of work you put into this writeup. Bravo!
I’ll just respond to one part that jumped out at me…
This is a general quirk of the way that variables are handled in filters — i.e., when a variable is undefined, it’s treated as a blank value, but not a null one. So [<count>else[0]] won’t produce 0 when <<count>> is undefined, because [[]else[0]] gets (unhelpfully) evaluated to [[]].
Introducing the mathematics operators “solves” the problem because (quoting from that page)
If the argument cannot be interpreted as a number, the value 0 is used (e.g.
foois interpreted as the number 0)
So you could in fact omit the else[0] entirely and get the same result from [<count>add[1]subtract[1]]. But for a more semantically sensible fix, I’d recommend [<count>!match[]else[0]] or [<count>!is[blank]else[0]]. 