Do people taking part in this sadistic joy lead to an improvement in how society functions? If we were a social engineer, trying to design a better-functioning society than the present one, would we want to include more people with a predisposition to such joy, and cultural norms that encourage such joy?
I'd say no. There is a personality type that is more prone to experiencing such joy, a sadistic personality type, and this personality type is in general more detrimental to society than the average person. The joy cannot be aimed only at those who deserve it; the sadist tends to be sadistic towards anyone in their way, or easy targets that they can get away with being sadistic towards. This harms the innocent. So, the social engineer would wish there to be fewer people with this personality type.
So much for the sadistic personality type. What about cultural encouragements towards such joy? For instance, we can think of the "Two Minutes Hate" from 1984, in which authorities gather everyone in a room and encourage them to hate a particular enemy of the state. Again, I'd say this tends to be detrimental, because the attitude so encouraged will spill over into other social interactions, and harm people who do not deserve it.
It also encourages emotion-based decision making, such as in the sentencing of criminals or decisions to go to war. It biases these decisions towards greater cruelty. Society would be better off if such decisions were instead motivated by a rational weighing of costs and benefits, and compassion towards those who would be harmed.
Let me disclaim that if such joy could be experienced only towards those who truly do deserve it, and if such joy could be prevented from biasing decision-making towards greater cruelty, then it would do no harm, and joy is joy, which is good. But in practice such criteria cannot be met, so sadistic joy is detrimental to society.