So I don't know if there's a word or short phrase for this scenario or personality trait but examples to help narrow it down. The central premise is sort of "if I can't have it no one can" or "if I have to suffer everybody else must as well".
A story I read from a book I don't remember (I think it was Defining Decade maybe) was a pregnant woman was furious at her husband walking in with junk food (pizza) when she couldn't eat stuff like that. She later noted that it wasn't fair as he was simply making himself feel better by eating something he liked after being stressed and waiting together with the wife through something, and that the celebration flowers happened to unfortunately be delivered after he had come in.
Less similarly from Harry Potter in one of the earlier books (1-3 I think ,but don't remember) fat Dursley kid goes on a diet and as a result everybody in the house goes on a diet together with him, sort of in solidarity.
Even less similarly would be a story about in solidarity somebody's family all shaved their heads because one member had cancer.
It's overall the concept/situation that if one person has to suffer or lack something, everybody else must (arguably needlessly) as well.
"if I can't have it nobody can"
.