I can answer that, but it's kind of boring and long.
Basically, puns were considered a sign of great wit and intellect for quite some time, as conversation was the primary means of communication, knowledge transfer, AND entertainment. They're in fucking everything once you know to look for them.
However, during the Enlightenment, puns became seen as 'low' humor, because they were seen as making language 'messier', in an era when we were trying to make the world cleaner, and better understood. Thus, many great intellectuals of the time noted their disdain for punnery, that it was a pernicious and low form of humor.
This then caught on with those attempting to affect high status or taste, and thus, a cultural contempt for the pun was built. But, as you note, puns are still funny, so people still make them. This then created a new trend: you could laugh at a pun, but only if you noted that you found it distasteful. ("Oh man, that was funny, but it was so bad.") This created a downward trend of appreciation: the more you liked a pun, the 'worse' it was, and therefore the worse 'punishment' the speaker deserved.
"You should arrested after such an assault on the poor English language."
"My god, man, after murdering the poor thing, he deserves the electric chair!"
This was especially common in writing, since it allowed you to write a good/bad pun, and then have other characters wittily condemn it, letting you have your cake and eat it, in a comedic sense. ("Sure, "puns are bad", but I got to write the pun, and the funny reactions to the pun.")
This has been coarsened, and the nuances lost over time, so now people just know "if someone makes a particularly bad pun, the proper response is to threaten them."