What do we call a person who always tries to judge their own actions in a positive way, or convince themselves that what they do is always right?
Words like egotistic or egotistical ("Believing oneself to be better and more important than others") may apply, as may egocentric ("regarding oneself and one's own opinions or interests as most important or valid") or narcissistic (as used in phrase narcissistic personality disorder). More generally, terms like realistic or unrealistic may apply, depending on whether subject's opinion is correct or mistaken. In some cases, one might call the person a Pollyanna ("person who is persistently cheerful and optimistic, even when given cause not to be so") or Panglossian ("having the view that this is the best of all possible worlds").
Regarding positive or negative connotations of these and other words, among the set of near-synonyms aloof, arrogant, blustery, boastful, bombastic, cocky, conceited, egotistical, flaunting, grandiose, haughty, insolent, narcissistic, ostentatious, pompous, pretentious, self-important, supercilious, uppity, vainglorious, vain, big-headed, high-and-mighty, show-offy, snobbish, snotty, snooty, stuck up, nose in the clouds, holier-than-thou, in my estimation all carry some negative baggage, and those with the least-negative senses include arrogant, egotistical, flaunting, and supercilious; and of those four, only egotistical is adequately close to the meaning requested in question. Note that self-righteous is a rather more negative label than egotistical. Realistic, if you can apply that label, is positive or neutral, and unrealistic is negative or neutral.
I have said terms arrogant, egotistical, flaunting, and supercilious are less negative than others, partly as a consequence of how similar terms are used in Aristotle's Nicomachean Ethics, as for example the lengthy discussion of pride in Book IV part 3. However, the slightly-technical usage there is uncommon, so only a weak basis for comparison.
If I understand your question correctly, I think you're looking for the term self-righteous. From an on-line dictionary:
self-righteous ▸ adjective: showing that you are too proud of your own moral behavior or beliefs, especially in a way that annoys other people
Synonyms include smug, priggish, and sanctimonious. Sometimes, the idiom holier-than-thou is used.
We normally refer to what such a person does as self-justification, and because we normally don't agree with his position, we tend to associate the term with making excuses for wrong behaviour, rather than judging oneself positively.
Nevertheless, I think he can be called a self-justifier - one who excuses or justifies himself.