When it comes to doing something that is the right thing to do, we will find out that it isn't really nice. Many of these things can be either reproving a character for doing something that is either stupid or immoral, physically harming another for seemingly in the verge of losing control of himself, or criticizing others' abilities just to motivate them to do better. After doing the deed, there's an uncomfortable feeling inside the character, and that feeling is regret for doing what he needs to do.
Let's say that a child is misbehaving badly, or did something he knows he isn't supposed to do. The parent comes in to punish the child. As soon as the parent is finished chastising the child, the parent feels guilty, asking themselves "Am I being too hard on him/her?" Another character, usually the parent's friend, objects, saying they're doing the right thing, and the child will get used to being disciplined sooner or later.
It can involve two siblings, two friends, or a married couple. This can often be a part of a Break Up Make Up Scenario if reconciliation is always optional, but if not, then the relationship will harden and may be broken. This may cause the audience to sympathize the one doing the right-but-not-nice thing or even the one who has made an error.
Compare Minor Insult Meltdown which is where the victim being punished will fall into this. Also compare My God, What Have I Done? which the action was reprehensible and is not justified, but the character regrets it. A rather lighter version of Dirty Business. See also Jerkass Realization and Made Out to Be a Jerkass.
May be Alas, Poor Villain if taken to extremes. A nice guy who had his buttons pushed may experience this. Can somewhat be a Family-Unfriendly Aesop since this is about a person feeling remorseful for their justified actions towards the person who shouldn't have done wrong to them in the first place. Can be Truth in Television for some parents don't feel comfortable in punishing their children. This is often the reaction to a child being The Runaway. A very suitable reaction of the Pushover Parents. Can be why Being Good Sucks.
In Hayate the Combat Butler, Hayate is in a pinch (as always) this time needed a team to do a dungeon crawl to get his job back and naturally goes to Hinagiku first (as always). She's still pretty upset at him exploiting her fear of heights during the marathon race the day before to take them both out of the race so Nagi could win (which she didn't, thus why he had to do the dungeon crawl) and gives him a really hard time. After he bolts without even asking for her help, she starts to feel bad and notes that it looked like he might have had something serious to tell her so she winds up getting worried and going to help anyway.
It also proves important to Hina's character arc as even she didn't know why she was being so hard on him for something so minor and why it bothered her so much, eventually realizing that she was in love with him and in immense denial due to trauma from her past after a pretty long period where she would give Hayate the cold shoulder only to regret being so hard on him and try to make up for it.
In The Longingverse, Rainbow Spectrum wonders this after he tells Rainbow Dash that she will never become a Wonderbolt. By the time he goes to apologize, she had ran away to Cloudsdale.
King Triton dwells over this after scolding Ariel in The Little Mermaid. He also thinks this after destroying her secret grotto filled with human treasures. To be fair, he did go overboard with the latter.
In Lady and the Tramp 2, after Scamp runs away, Tramp worries that his son ran away because he scolded him for thinking like a wild dog.
In the third Madagascar film, Alex and the others decide to track down the penguins and chimps, thinking that they had abandoned them in Africa despite planning to come back for them. As part of an elaborate plan to confront them, Alex decides that step 1 is meeting them, step 2 is to give them hell for abandoning them, and step 3 is to realize that they were too hard on them and apologize. The plan ends up going off the rails, and Alex accidentally skips to step 3 when they meet them. Skipper accepts the apology without question, and orders his men to move out. Alex angrily realizes that he told them he was sorry without chewing them out first.
It also happens to Samson and his son Ryan from The Wild. Right when Samson yells at his son for causing them the game out of "jealousy" that he couldn't roar, Ryan flinches. Samson sees this and apologizes right away, but Ryan inverts the I Have No Son trope by saying he wishes his father really wasn't his father.
In Mickey's Twice Upon a Christmas, Mickey send Pluto to his doghouse after his attempt to put the star on the Christmas tree ended up with all of Mickey's decorations destroyed. Later, when Mickey fixes everything, he begins to feel bad for how he yelled at him and goes to the doghouse to apologize, only to find that Pluto had run away.
In the The Prince of Egypt, Moses asks Seti if he was too harsh on Rameses by calling him a weak link who will bring Egypt to shame, just after Moses took blame for goading Rameses on their chariot race.
The Left Behind series have both God and Jesus who did not enjoy sending the Antichrist, the False Prophet, and the people who rejected Him to the Lake of Fire for eternity. This quote from Jesus sums this up:
"Like My Father, with whom I am One, I have no pleasure in the death of the wicked, but justice must be served, and death is your sentence."
In the S.E. Hinton book The Outsiders, Danny cries to Ponyboy who was in the hospital, but Ponyboy comes to realize that Danny is acting hard with him throughout the story because he wants a future for him.
In Harry Potter and the Prisoner of Azkaban, McGonagall thinks she was too hard on Peter Pettigrew during his school days, due to the fact that he went on to die a heroically foolish death. Or so she thinks.
Firestar from Warrior Cats feels upset that his daughter Squirrelpaw (later Squirrelflight) ran away because of what he said. When he realizes that he told her she wouldn't be a warrior if she kept meeting with Brambleclaw (who's from the same Clan but he's keeping them away for a slight reason), he blames himself.
In Happy Days, Ritchie's father threatens to make Fonzie pay for damages to his roof due to a pigeon house that the Fonz built on the roof. He admits later to his family that maybe he was too hard on Fonzie. Played with, in that Fonzie later decides to sue him.
In the Full House episode "Joey Gets Tough", Joey, who plays the Parental Substitute for Danny, asks Jesse about how D.J. feels after he grounded her for sneaking to karate class.
Another example is when Jesse seems a bit hurt when both Nicky and Alex referred to him as a "mean daddy".
The Fresh Prince of Bel-Air hilariously played with this trope in the episode "Asses To Ashes" where Carlton, Hilary, and Ashley chewed out Will for (accidentally) killing Judge Robertson, figuring it would get him out of his funk. Then Will starts wailing like a little kid and the three were a bit shocked. This led Carlton saying "I could be wrong."
In the Lazytown episode "Zap It", Stephanie apologizes to Pixel for being harsh with him for creating the zapper device which makes everything invincible instead of disappearing.
This doubles with Why Did You Make Me Hit You? in the second season of Rescue Me where Sheila's lesbian lover beats her in a fit of jealous rage. After that, she comes to console her, saying "I'm sorry I was so rough with you, but sometimes you just make me so angry."
The Bible: A few scriptures such as Jeremiah 8:21 shows us that God doesn't take pleasure in punishing those who sinned against Him:
"For the hurt of the daughter of my people am I hurt; I am black; astonishment hath taken hold on me."
In World in Conflict, Col. Sawyer is emotionally distraught by the fact that he previously treated Capt. Bannon like crap (entirely justifiably, by the way), after Bannon pulls a You Shall Not Pass on the Soviets and dies by nuke. This, along with general stress upon him, contributes to Sawyer making several strategic mistakes late in the campaign.
In Final Fantasy VIII, Quistis tells Rinoa off for suggesting a risky plan for neutralizing the sorceress while Quistis and her fellow SeeDs are already in the midst of preparing the assassination they've been hired for. Shortly afterwards, she lets her worry that she might have been too harsh towards Rinoa prompt her to leave her post in an attempt to apologize - a poorly-considered emotional decision that leads to Quistis and her entire team getting locked in General Caraway's study just as the mission is supposed to begin and barely making it back to their post in time.
Another examples comes from "Peter's Two Dads" where Lois spanks Stewie, but then as soon as Stewie starts crying, Lois begins to feel terrible and starts to apologize, but Stewie runs from her.
In the Phineas and Ferb episode "Phineas And Ferb Get Busted", Lawrence tells Linda that they've been too hard on the boys after sending them to the Smile Away Remoratory School for engaging in their usual activities.
Another example is found in the episode "Dude, We're Getting The Band Back Together" where Phineas asks the lead singer of Love Handel, Danny, was he tough on the guy who wasn't playing the guitar properly. His response was "He'll be back when the spirit calls him!"
In "Gary's New Toy", Spongebob was hoping that Gary isn't upset with him when he restrains him from constantly chewing on his new red ball.
Another example happens in "Whatever Happened To Spongebob?" where the others get tired of Spongebob's clumsy behaviour and very bluntly tell him to get lost. They are guilt ridden when they find out he has run away because of this later on.
In "Fools In April", Squidward, who was really irritated with Spongebob's April Fools pranks, realizes how much of a jerk he is for making him cry with the nasty prank he set up.
Fairly Oddparents. In the end of episode "Pipe Down", Timmy's Dad apologizes to Timmy for yelling at him for making the family lose to the Dinklebergs in a game of charades.
Played to it's most poignant tee in the Pinky and the BrainChristmas Special. After Brain repeatedly chews out Pinky for ignoring their plan for his Christmas letter, driving Pinky to tears, he eventually reads the letter out of curiosity, to find it is a touching speech about his 'best friend in the world, the Brain' that asks Santa to give all of Pinky's gifts to him, since he never gets the reward he deserves. While he does not mention this trope, the emotional exchange makes it very clear how he feels.
Done similarly in the My Little Pony: Friendship Is Magic episode "Sisterhooves Social" after a fight with Sweetie Belle over causing problems including, among other things, using all her gems to make a picture, Rarity begins to dwell over this. The final nail in the coffin is when she finally looks at the picture Sweetie Belle made; her and her big sister inside a giant heart made of gems. Cue hammy My God, What Have I Done?.
In the episode "Big Fat Alien Wedding" of Ben 10, Mr. and Mrs. Tennyson apologized to Camille for being tough on her, but this was due to them being against the wedding due to her being a sludgepuppy, which they despise. She instantly forgives them and accepts them into the family, though.
In the "King of the Hobos" episode of The Little Rascals, after Porky runs away, Darla suggests to the other boys that exiling him from the treehouse might have been too harsh a punishment for eating all of their food.
In the Super Mario World episode "Born to Ride", Princess Toadstool gets mad at Mario and Luigi for scolding Yoshi for eating the bamboo pipes they were using to get indoor plumbing into the cave.
In "Bart vs. Thanksgiving", after Bart runs away after being sent to his room, Homer and Marge feel this way when explaining to the police what happened.
In "Mona Leaves-A", Homer gets mad at his mother Mona for always leaving him to go on and calls her a horrible mother. Later that night, Homer feels bad about what he said and decides to make a card for her, only to find she died later that night.
In the Futurama episode "The Mutants Are Revolting", Leela yells at Fry when she's banished to the sewers after he inadvertently revealed she was a mutant. She later remarks "Maybe I was too hard on him. He didn't ruin my life on purpose."
In The Powerpuff Girls episode "Twisted Sister", the girls scold Bunny for breaking criminals out of jail instead of helping them, causing Bunny to fly away crying.
Bubbles: Aww, do you think we were too hard on her?
(girls see the criminals Bunny freed surrounding them)
Criminals: Not as hard as we're gonna be on you! (cut beatdown)