Appropriate Punishment vs. Retaliation and Abuse

Inflicting "punishment" on another person for one's own emotional reactions is simply abuse.  It's bullying.
There are specific scenarios where "punishment" is appropriate, and those are limited to disciplinary measures regarding actions that don't comply with standard guidelines. In other words breaking rules or laws, or refusing to hold up one's responsibilities.

A parent or another supervisory adult is appropriate in "punishing" a child for misbehaving, such as suspending privileges, or putting away a toy (or a game, or a cell phone), when they do things like refuse to follow rules, if they mistreat another person or animal. or if they lie.
These are behaviors that have objective, outlined standards that are the same for everyone in a group.
Megan lies, she gets grounded for two days, Ronald lies, he gets exactly the same punishment as Megan did.
Not more, and not less, because the punishment is for the ACTION of lying. It's not about whether someone LIKES the certain child or not, or is MAD AT the child or not, or is EMBARRASSED by the child or not, or is trying to "put the child in her/his 'place'".

However it is not appropriate to punish a child for things like: not complying with abuse, for feeling confident, for expressing emotion (not the same as behavior), for asking questions, for not behaving "feminine enough", "masculine enough", "black, white, Asian enough (etc)", for being "too smart"/"too curious"/"too creative", for NOT BEING SIMILAR ENOUGH to someone, or for "being annoying" because their general personality doesn't MATCH an adult's personality.
A child's role is not to cater to the feelings, comfort, or ego of other people in their environment. 

"Punishment" is also appropriate toward adults who are voluntarily WITHIN a community or organization, where guidelines and laws are SPELLED OUT, and agreed upon by general consensus. And, where the "punishments" for breaking laws and not following guidelines are also laid out. So if a person speeds on a road with a posted speed limit in the US, it is KNOWN that they are breaking the law, and they should EXPECT to get pulled over and ticketed; that's the law, and that's the "punishment" for breaking that law that's been agreed upon. If a person ASSAULTS another person, if they are in sound mind, they surely know that it's against the law, and that they will receive PUNISHMENT for breaking that law.

Those, again, are examples of disciplinary measures that have been decreed and agreed upon that whoever breaks a law will receive.

The punishment is for the ACTION, and the laws and guidelines are agreed upon and known.

It's not a RETALIATION.

If Mary runs a stop sign, the police officer doesn't pull her over because they don't LIKE Mary personally. They pulled her over because she ran the stop sign, it's the law. Mary voluntarily lives in her community, which means she agrees to abide by the basic laws. Mary voluntarily drives a car; she is volunteering to abide by the traffic laws. Not because she's "submissive" or a "sheep", but because traffic laws are there for specific reasons of traffic flow and safety for everyone who's on the road, driving a car, a motorcycle, a bicycle, a delivery truck, walking by themselves, walking with a child, walking with an animal, etc.
If Mary or her friend John doesn't LIKE the laws, then since they are VOLUNTEERING to be citizens in that community, they can go through the process of helping to CHANGE the laws that they don't like. If they don't want to do that, then they can MOVE, if they live in a free country. 

If the police officer pulled Mary over for ignoring the stop sign, and then decided he/she didn't LIKE her, so they cited her for doing all kinds of other things "wrong", or treated her disrespectfully, then THAT would be inappropriate "punishment" and "retaliation", which is a common behavior in certain personality disorders.

Those with control issues for whatever reason/diagnosis may try to inflict "PUNISHMENT" on another person according to their OWN EMOTIONS and moods. This is retaliation, however, not actually "punishment".

Rages, name-calling, threats, slander, kicking someone out of their home, taking away their resources, blocking them from resources or support, back-stabbing, condescension, assault, shunning, and betrayal are examples of RETALIATIONS that those with control issues may try to inflict on another person, and will often call "punishment".

Healthy adults don't "punish" other adults, and healthy adults don't punish children for their own emotion and ego issues.

.
.