The difference is that when specifying a filter operand, you use square brackets only with literal operand values. Thus, in the first macro, because the $tag$ is a macro parameter that is automatically substituted into the filter syntax by the TWCore macro processor, you correctly wrote tag[$tag$]. However, in the second macro, tag2 is a variable that is referenced by the tag filter and, when using a variable as the operand of a filter operator, you use single angle brackets to surround a variable operand reference, instead of the square brackets you used previously for the literal $tag$ operand value. Thus, you need to use: tag<tag2> in your filter syntax.
Your second macro should be written as: