SO is a repository of useful answers / knowledge. If you posted an answer years ago and haven't updated it yourself to generalize it once it gets a ton of traffic / upvotes, and aren't even around to review changes to it, SO as a community has a good reason to make edits to an answer that shows up in search results.
If the original author was around and did object, that would be their right and I'd have no problem with @bradhouse rolling back an edit. Unless and until that happens, current SO users can and should take responsibility for maintaining popular old answers. Careful well-thought-out edits that try to preserve the author's voice / intent / style are a Good Thing, and directly help make SO more useful to more people, and are worth a small to moderate intrusion into what the original author said.
Adding yet another answer instead of editing is not a viable alternative in cases like this. It doesn't really help solve the problem that an existing massively-upvoted-and-accepted answer is not as helpful as it could/should be for the many people who will read it in future. There are already 18 answers, and a new one will be lost in the weeds for years, and still not shown first unless the still-active OP accepts it. An edit is the only viable way to get better content for searchers in a reasonable time-frame.
Also, note that even though the edit added code, it didn't change any of the existing code. Code edits are somewhat dangerous, but nobody is claiming that the code introduced by this edit is actually wrong. So it has now been reviewed by many eyeballs without finding any problems, and thus should be fine to put in a highly-visible SO answer, because it looks like a much simpler example.
There are differing opinions on whether this edit would have been appropriate in some obscure answer with a couple upvotes on a low-traffic question. I think it's fine on it's own merits, but @Lightness Races in Orbit's answer does make a reasonable argument about "Not substantially the same as before the edit". That's debatable as a default criterion, and it's also debatable whether it's true or not for Tiny Giant's edit. I have no problem accepting that as a valid position on edits in general, but that's not the point of this answer.
Everyone agrees that there is a limit. The argument is that the specific circumstances of this edit change the limit from its "default" position, and should make it acceptable even to people who don't really like this kind of edit in general.
I'm not saying that old answers are a free-for-all. Totally changing the answer, even if it's popular but wrong / dangerous / a bad idea, or just obsolete due to language changes, is still not ok even on ancient answers, especially where the author isn't around to review. (Editing in a warning note may be appropriate, depending on how subtle + dangerous the problem is).
(If the user is still active, i.e. last seen within a couple days, I think it can be ok to make significant corrections and leave a comment. If they're long gone, you have to take even more care as an editor to only change things when you're really confident you're correct and that you aren't introducing errors, as well as that you aren't distorting the answer so it's different from what the previous upvoters liked about it.)