It’s because Mortarsman’s ability deals indirect damage to all enemies, but that damage is considered an effect, rather than an individual attack on all enemies (because that could proc half-a-dozen defensive abilities in turn, you see).
Ironically, Mortar Kombat’s description tells you exactly what happens:
“When attacking, does not deal damage to target directly but deals 40% to 60% of the damage to each enemy, including its target.”
Your attack never connects and deals damage; instead, an effect deals damage to all enemies. Thus, “attacked” and “attacking” flags never trigger, preventing Mortarsman from getting swarmed to death every time it fights a countering group of enemies.