When you shoot a gun, all the focus is on where the bullet goes. We forget that the recoil can pack a punch, too. As far as my deeply unscientific brain understands it, it's basic physics that applying force is going to mean some of that force coming back to you.
Sometimes, it's a similar concept with words. Many of us have been in situations where we're around someone who needs to be taken down a peg, but it requires us taking an L as well.
This also happens regularly on the internet, as a place like r/KamikazeByWords makes clear. The best victories are often bittersweet, which they're bound to be if you're taking a jab at yourself as well. While I can't encourage low self-esteem, there's no denying that the people in the examples below are very witty. Sassiness is a skill that can't always be taught as well as this.