Is pain an evolutionary evolved feature?
I can see the usefulness of a warning system that allows injury to be detected, mitigated and protected so the body can repair.
And for that it is very effective: any injury to the skin or flesh wounds are detectable, can be protected and will eventually heal.
But first remember that this system was developed well before we were conscious beings probably back to the times when fish were the most developed animals on the planet hundreds of millions of years ago. In the past if a fish, mammal or primitive man encountered pain there was literally nothing that could be done about it. And this is why it is complicated.
First of all if you sustained a massive injury being incapacitated by pain is simply no way to encourage survival. Yes some people go into a kind of adrenaline fueled "super human" mode but many do not. They just black out from pain or whatever. How is this useful?
This leads me to point two. Of what value is internal pain? Why are there pain receptors in locations that cannot be reached by pre-technology man? Before the advent of surgery there is literally nothing useful that can be done with this information.
Lastly, of what value is chronic pain? Perhaps as a reminder to slow down or be careful? Often times slowing down or being careful doesn't help or prevent injury so what's the use? And what about the myriad of other chronic pains that come from cancer, infection or genetic disorders? Being in constant pain only serves to make a person suffer for no reason.
I can't see how pain was an evolutionary advantage. Perhaps these side affects are nothing but spandrels? Perhaps chronic pain did not stop us from reproducing and we are left with a disappointing warning system.