I think that self-pity and especially how other people react to it is an interesting subject.
Like most emotions, there's nothing wrong with it- to a limited degree. I prefer to use self-compassion over self-pity. But before discussing that it should be made clear what the difference is between self-pity and self-compassion. What do you see as self-pity?
I think people who self-pity are sometimes handled/critiqued too harshly. As someone who has probably been stuck in self-pity when I was younger, I can say that you create your own 'reality'/'truth', that you can get stuck in a 'bubble'. All too often, outsiders try to break your bubble to show you 'their truth'. Causing people who are stuck in self-pity to become more reticent. People who are stuck in self-pity seem to relate more to the "I'll see it when I believe it," mindset. It's no use to 'violently' try to change their mindset. Someone must be willing to change in order for that change to be able to occur. Though this is again more nuanced with self-pity. There is a want for change, but at the same time they want to stay in their bubble. Unfortunately you can't be both in and out of your bubble at the same time.
Self-pity in the traditional sense however, is not useful or healthy when it's the only technique someone has to deal with more difficult situations, when it becomes a habit.
This is how Wikipedia defines self-pity: "Self-pity is an emotion 'directed towards others with the goal of attracting attention, empathy, or help' and one in which the subject feels sorry for (feels pity for) themselves."
Wanting attention, empathy and help (from time to time) are basic human needs. However, I think it's understandable that people close, or just people who have contact with someone who is stuck in self-pity get annoyed by that kind behaviour/thinking pattern. Especially by how ​they try to get attention/help.
When I think about self-pity, I think about people who lack maturity. The maturity to deal with certain emotions and events you'd expect someone to have at a certain age. Think about a situation where someone par example gets told by their boss -in a respectful manner- that the room they had to clean is not properly cleaned. Someone with self-pity will throw a tantrum "I can't ever do anything right! I know, I am a failure,..." and sit in a corner complaining to themselves (and others) how bad they are at their job.
While someone who is self-compassionate will acknowledge (to themselves -and others-) that they feel hurt, maybe ashamed or disappointed that they failed their job, that their boss is not happy with their work. They allow themselves to feel those emotions and are aware of what they feel. But they will also recognize that their boss has a point, that their boss didn't have the intention to hurt them and that they'll have to work at their cleaning skills.
As you see, are people with self-pity self absorbed. Not only can they become toxic to themselves, but also to their surroundings since they fail to see their own contributions. While it seems like they take the blame for the room that is not properly cleaned, they are unable to deal with this event in a constructive manner. It's their boss who critiqued them too harshly, everyone is against them,... And after this: nothing happens. It's a circle of whining and complaining without taking the opportunity to work at themselves. To not only look inwards but outwards too.
So yes, I also understand people who don't want to associate with people who are stuck in self-pity. Especially after noticing that they often times also have passive aggressive tendencies and that they lack self-awareness (with them running into their own pitfall since they believe they are self-aware because they spend so much time in their head).
On the other side I get equally annoyed by people who won't even allow someone to feel their feelings and/or complain. Feeling your feelings, thinking your thoughts is sometimes already seen as 'self-pity'. There's no time for your feelings and thoughts, get over it and continue with what you were doing...