One of my favourite books is Mistakes Were Made but Not by Me by Carol Tavris and Elliot Aronson. That book is about self justification and judgement; how we remember things--and our general human tendency to subconsciously tilt the scales in our own favour when doing so.
Alicia posted the poem Misattribution (clicking on the word will take you there,) which is what I am recommending you read, to illustrate the fundamental attribution error - a pyschological framework for understanding a similar principle and the underpinnings that drive us in that direction. I loved the poem and am grateful for Alicia taking me deeper into understanding a human tendency, which we can guard against in ourselves and others the better we know it.
Living Bible (TLB)
13 Then he added, “Now go away and learn the meaning of this verse of Scripture,
‘It isn’t your sacrifices and your gifts I want—I want you to be merciful.’[a]
For I have come to urge sinners, not the self-righteous, back to God.”