Self-righteousness is a loaded term. By loaded, I mean it is loaded with meaning, and sometimes that meaning can be different with different people and different uses of the term.
You will not find the term "self-righteous" or "self-righteousness" in the Bible, or at least not in the King James Version or the New King James Version (except maybe in headings or comments, not translated from the original text). But there are certain principles taught in the Bible that relate to the modern English term "self-righteous".
We have a concept of self-righteousness according to the common usage of the term today. It usually refers to someone who takes things to an unbalanced and wrong extreme in trying to be more righteous than others and/or finds fault with others who do not measure up to the self-righteous person's standard. It has to do with comparing oneself with others and looking down on others. It is characterized by some of the Pharisees, who trusted in themselves that they were righteous and despised others (Luke 18:9-14).
The Pharisees often found fault with the disciples of Christ for eating with unwashed hands and similar things, which were not really important. They seemed to take pride in their righteousness, feeling superior to others, and criticizing others.
Did Job have this kind of self-righteousness?
I don't see evidence that he was overly critical of others or that he took things to an unbalanced extreme in trying to be righteous. He was not like the Pharisees who criticized those who did not wash their hands before eating, for example.
In fact, in the matter of being overly critical of others, I think Job's three friends, who accused him repeatedly of sin, seemed more like the example of the fault-finding Pharisees.
I don't see where Job had a fault-finding attitude towards other people. I don't see where Job was concerned with do's and don'ts he made up and held to apart from God's law, like the washing of hands, like the Pharisees did. Rather, in his description of his life before he was afflicted, in Job chapters 29 through 31, it seems he did a pretty good job of obeying both the letter and the spirit of God's law of love. For example, he would not even look at a woman to lust after her (Job 31:1). He showed kindness to the poor (Job 31:16-23). He did not set his heart on riches (Job 31:24-28). In all his ways, he did not show what people commonly think of when they hear the term, "self-righteous".
Job may have had a different kind of self-righteousness, one that is not commonly understood by the way most people use the term, "self-righteous".
Job's problem was a lack of faith in God's righteousness. He felt God was unjust to afflict him. And in this evaluation, he compared himself with God and maintained his own righteousness apart from God. He also focused on his own righteousness rather than God's, seeking to justify himself in his evaluation rather than justifying God and God's decision to afflict him.
These verses illustrate Job's problem:
" 'As God lives, who has taken away my justice, And the Almighty, who has made my soul bitter, As long as my breath is in me, And the breath of God in my nostrils, My lips will not speak wickedness, Nor my tongue utter deceit. Far be it from me That I should say you are right; Till I die I will not put away my integrity from me. My righteousness I hold fast, and will not let it go; My heart shall not reproach me as long as I live' " (Job 27:2-6).
"So these three men ceased answering Job, because he was righteous in his own eyes. Then the wrath of Elihu, the son of Barachel the Buzite, of the family of Ram, was aroused against Job; his wrath was aroused because he justified himself rather than God" (Job 32:1-2).
Job may have been proud of his righteousness, and that could be a big part of his problem. In any case, his focus was not on glorifying and honoring God. When it came down to it, feeling that he was righteous was more important to him than believing that God was righteous. He preferred to defend himself than to defend God. He was not thinking, "Whatever God's reason is for afflicting me, He is right and just in what He is doing, because God is perfect in righteousness and infinite in wisdom and I am not. Maybe I have a fault in me I don't know of, or maybe God is testing me, but whatever God's reason is for afflicting me, his decision is right and good, because God is more righteous than I am."
He may have had the right attitude in the beginning of his trial. " 'Naked I came from my mother’s womb, And naked shall I return there. The Lord gave, and the Lord has taken away; Blessed be the name of the Lord.' In all this Job did not sin nor charge God with wrong" (Job 1:21-22). "Then his wife said to him, 'Do you still hold fast to your integrity? Curse God and die!' But he said to her, 'You speak as one of the foolish women speaks. Shall we indeed accept good from God, and shall we not accept adversity?' In all this Job did not sin with his lips" (Job 2:9-10).
But under the pressure of affliction, it came to the surface that when it came to a choice between believing in God's righteousness or his own, he defended himself more than God.
Yes, Job's problem could be described as self-righteousness, as long as we do not confuse his problem with the problem people usually attach to the term, the problem of despising other people and general fault-finding like the Pharisees. I don't see evidence of that in the book of Job, except perhaps with Job's three "friends" who accused him falsely.
The focus in the book of Job is how we think about God. Do we believe God is righteous? How strongly do we believe that? Do we really trust God and all His decisions? How strong is our faith in God's word, His promises, and His perfect character, especially when we are suffering in a trial?
This is what the book of Job is about.