Cause an author wanted to write about that kind of story and decided it'd be easier to just ignore the past rather than make a logical explanation as to why things are proceeding in this fashion this time around, not that he'd be able to explain himself since there's no good reason for this kind of dumb scenario to occur.
Pretty sure the stock apologetic for 'why nobody has sentenced Joker to death' is 'insanity plea'.
This was just the first time in a long time anyone had decided to treat Napier like he knew exactly what he was doing and the hell with making exceptions for those of uncertain mental competence.
Which, again, they should have done a long time ago, but there's a reason society as a whole is the butt of his jokes.
Probably the only reason Batman felt it necessary to intervene is that, for once, Napier /wasn't/ claiming responsibility for something he'd been accused of...because, for once, he hadn't actually /done/ it.
There's an argument to be made that, if one is going to execute someone for something, it should indeed be a thing they did...there are good, moral and ethical reasons not to want to kill someone for something they didn't do, even if you pretty much know they deserve it for the other things they've done. Certainly, no one should be used as a scapegoat for someone else's sins.
It's difficult to meaningfully tabulate all of Napier's crimes against any one version of Napier, because not all of them share all their sins. It's very easy for us to sit back and say "Batman should have let this ass fry by now." because we have a relatively omniscient view of the character across multiple incarnations. But we probably wouldn't say that the West-verse Joker should die, if only because he never really got up to that kind of crime. Certainly, he can't be meaningfully held accountable for Napier-16's deployment of Smilex in urban environments, and so on.
Beyond the events of the show, we don't know the full extent of Napier-16's crimes against society, though the whole Injustice League schtick was bad enough on it's own. It was not, however, something implausible for him to wriggle out of...I'd find it very likely that the Joker enjoys working with other supervillains because it makes it easier to pawn responsibility off on them while taking refuge in his own obvious lunacy...if Batman bears guilt for leaving the Joker alive, knowing how he acts and reacts to the world, then it follows that the Injustice League, too, was responsible for exploiting those tendencies for their own ends.
Where does that leave Napier, in terms of legal culpability? If he's just a mad dog with no capacity to be meaningfully responsible for his actions, that leaves us in the position of needing or wanting to execute him simply to stop him...not to punish him, because he is clearly insensate to punishment. Certainly, we don't want to kill him as an article of retribution...which is all too easy to fall into, and which he would gleefully invite for the sake of finally getting to deliver the punchline of his life. It may be the /practical/ choice, but it's not one anyone has a terribly easy time making, come the hour. Nor should they.
Humans are, generally speaking, much less comfortable putting down a mad human than they are a mad dog...if only because it tends to set dangerous precedents. The kind of precedents that ultimately serve to make the Joker's point, such as it is, for him.