They know they’re not a good person, at least they know they’re not good for whatever it is your definition of good.
My ex would be overly concerned about appearing good to everybody else except with me, and she had no shame in hiding it.
Quite often I would find her saying to other people how good she was, or how somebody said how good she was for whatever reason, or do small gestures of kindness that I would have to beg for, or just not receive because I was not going to control her -what she meant about it if far beyond me.
Because she was generally always the good person, even being associated with people that have been horrendous with me would trigger her sense of shame. Because in her mind being associated with somebody that did something bad made her a bad person by proxy, she would defend whatever these people did on hands and knees until you where the one with a problem and the cause of all evil. Try to figure out that logic.
I eat myself alive because of this too, but how would you feel if people knew what he did to you and how he treated you, and still had a decent relationship with him just because they had to be civil? A friend of mine, despise knowing everything my ex did to me, and despise being as supportive as she could, still has to interact with my ex on a weekly basis and be civil. Not by choice, but by circumstances.
I think what you need to do is take a mental count of all the people in your life right now, and see which one would interact with your ex because they had to, or because they wanted to. You don’t need to tolerate those that wouldn’t stick by your side, and this is not about choosing two sides, this is about knowing who are the people in your life you can rely on and those you can’t. I apply the same logic about everybody in my life really, I might be wrong, but I’m avoiding a lot of negativity by doing so.