It's not so much "don't speak ill of the dead" as "don't speak ill of the very recently deceased". I don't know where it comes from, maybe it emerges naturally out of our general moral nature and social codes? It just feels tacky and wrong.
_Except_ that people do break that rule fairly often, and I think the full rule is "don't speak ill of the recently departed unless you really, truly, seriously, hated them".
It's not that it's something you should never do, rather it's something you should never do lightly or glibly. Only do it if you really mean it (and hence are happy to take on those who will be offended)
Also, apropos of someone mentioned in this thread, another thing that occurs to me is that it's when your enemies die of age-related conditions that you really start to feel old yourself, which is actually a bit of a downer. You can actually miss your enemies...especially if their successors are too pathetic to properly detest.
In a non-political context, my old school being demolished made me sad, even though when I was there I always thought I'd pay money to drive the bulldozer myself.
A final point is it's also annoying when people who were no friend to someone when they were alive suddenly talk as if they were their greatest pal once they die. This is also P&N material, but certain figures were regularly denounced while alive only to be invoked as saints by those denouncers once dead.