Yes. Complex behaviour and memory, ability to execute complicated tasks, and many other features are usually more common in complex/large organisms. It may not be surprising, but it's certainly non-obvious why insects would have persistent pain after injury - especially if it prevents them from effectively getting on with other tasks after the initial injury source / danger passes.
On the other hand, you could say the same thing about feeling pain in humans. Once the danger/injury source passes then being in pain is not good, particularly chronic pain that actually inhibits the person. We still have that though.
I could speculate at least 2 reasons for persistent pain. Before medicine, if you broke a limb, it was likely not as functional / strong as before. Long term pain is probably a good reminder to be careful about it. Also since we can form complex relations in memory, it's potentially useful as "remember how you thought you could do this thing? well, you couldn't, so don't try it again."
I think for people the equation is a bit different. We care about individuals in general and have limited number of kids. That's not the case for ants for example which seem quite replaceable / not able to recognise individuals (or even if they're alive).
The article says the pain causes the fly to protect its other five legs, as though it has learned from losing one leg that losing legs is a thing that might happen again. It's feeling the pain in those legs, not the place where the one was removed.