It's not a bug. Tahm's damage is delayed, so if you exit while he's alive it hits you then.
Malz's ult is different in nature, both in coding and functionality. The damage on Malz is constant because it's a debuff. You can't move and take x amount of damage for the duration of the debuff.
Tahm's is "You take x amount of damage after the debuff/CC ends if Tahm is still alive."
Removing the CC ends it, so the system logic is working properly. Though annoying, it's not spaghetti or a bug.
CC-Removing abilities don't remove Tahm's damage either, because it's working as intended.
PS: Morde can actually kill himself at the moment.