term for psychological phenomenon?

Is there a term for a psychological phenomenon whereby a person — unable to deal in a mature way with their negative emotions toward a close friend’s or loved one’s undesirable behavior or attribute — copes by trying to eradicate any semblance of that behavior/attribute in their own self? More specifically what I have in mind is that this coping mechanism typically has two properties: first, it is pursued with passion and energy, providing an outlet for the negative emotion (and here the terms “displacement” and “compensation” seem relevant, though psychologists, please correct me if I am wrong). Second, it is pursued in a conspicuous manner, and sometimes even with an exaggerated and conspicuous sense of joy and satisfaction, in the hope of inspiring the friend/loved one to act likewise, even if intellectually the person knows that it is unlikely to have that effect.

Some concrete examples, since the above may have been a bit abstract:

[ul]
[li]A teenage boy is embarrassed by how puny his dad is, so he takes up weightlifting. [/li][li]A person is frustrated by how stubborn his friend is about not trying new foods, so he starts seeking out the most exotic cuisines possible and gushing about how delicious they are. As the friend’s behavior doesn’t change, the cuisines continue to get more and more exotic.[/li][li]A woman is fed up with her husband’s lack of exercise, so she takes her own exercise up a notch and perhaps eventually this culminates in her becoming an exercise addict when the husband’s behavior doesn’t change.[/li][li]A person is annoyed at the way his friend is always littering, so he starts doing volunteer work to pick up trash on the street and donating to environmental organizations.[/li][/ul]
My motive in wanting to know if there is a term for this phenomenon is that I’d be interested in any research that has been done on it. So if anyone can point me to relevant research in addition to or instead of providing a search term, that would be great too.

Would this be similar to the “cringe” when you see something on TV or in public that embarrasses you for the person?

That kind of cringing feeling could be the impetus for the behavior, but what I’m interested in specifically is when that feeling then leads one to go out of their way to manifest behavior of the kind opposite to what triggered the feeling, as a way of coping.

No idea what the technical term might be, but in our family, we call it “being inspired by a bad example.”

I was once in a convenience store, where several people were waiting in line. The guy at the head of the line was rude to the cashier. After that, everybody else in line went out of their way to be as polite as possible to the cashier. Nobody wanted to be similar, in any way at all, to the horrible boor they’d just witnessed.

It’s related to reaction formation. The whole “preaches against homosexuality and yet visits gay bathhouses” thing. Although I don’t know if that can include reacting to others’ behaviors.

I believe there’s some research of this but I don’t study social psych enough to give examples to find a term.