Most of us do our best to behave. We try to do the right thing, be polite, follow social/moral norms, and not harm others.
Yet punishment exists across society in as far back as history goes, albeit our ancestors doled out different forms of “punishment” then current society may permit (public stoning–not going to fly these days)! Evolution has instilled in humans the desire to identify and discipline wrongdoers. It is a part of our collective human nature. The reasons for direct punishment are clear. If someone wrongs you, retaliation reduces the likelihood that they will do it again. Additionally, if others see you retaliate, they will also be less likely to wrong you in the future.
When our goals are thwarted or we feel diminished in some way, many of us find ourselves in the uncomfortable position of having a lot of negative energy to unload but not feeling able to direct it towards the correct person due an imbalance of power. Thus, we punish the wrong people, usually those closest to us, making them suffer to relieve our own suffering.
Of course, this process is not conscious. We wait for some way to rationalize our behavior by citing the wrong behavior of the person we are punishing, but if we look deeply we can usually trace our hostility not to what this person has done, but to an unfulfilled desire to retaliate against the person who has hurt us.
If this setup is familiar to you, try a different route next time. Instead of attacking the wrong person, openly admit to your hurt feelings and ask for comfort and support instead. You’ll feel a lot better, which is why you’re trying to punish your loved one in the first place, and you’ll be strengthening your relationship instead of decaying it.
It can be pretty tough to admit to feeling diminished, you’re exposing your soft underbelly not just to someone else but also to yourself by admitting you have one. But it’s preferable to blaming and punishing a person who doesn’t deserve it, in effect making someone else feel just as bad as you have been made to feel yourself.