A sad sad fact of Kabuki theater.
The really sad thing is that the kabuki version has nothing to do with what actually happened.
The 46 samurai (the one ashigaru in the mob was let off) were sentenced to death by seppuku for killing a man, who had nothing to do with the death of their incompetent, drunkard, womanizing master, in the course of a conspiracy that was illegal even under Tokugawa vendetta laws.
What you see today as the “47 rônin” was written years after the incident and is really just a swashbuckling story like Dumas’ Musketeers.
Also, not every kabuki ends like that, but such stories, or several of Chikamatsu’s famous plays (like “The Love Suicides at Amijima” or “The Love Suicides at Sonezaki”) absolutely work like that. Tragic heroes are still very “in” in Japan, have been for centuries.