This is why I think Job is depicted by the self righteous man praying.
9 And he spake this parable unto certain which trusted in themselves that they were righteous, and despised others:
10 Two men went up into the temple to pray; the one a Pharisee, and the other a publican.
11 The Pharisee stood and prayed thus with himself, God, I thank thee, that I am not as other men are, extortioners, unjust, adulterers, or even as this publican.
12 I fast twice in the week, I give tithes of all that I possess.
13 And the publican, standing afar off, would not lift up so much as his eyes unto heaven, but smote upon his breast, saying, God be merciful to me a sinner.
14 I tell you, this man went down to his house justified rather than the other: for every one that exalteth himself shall be abased; and he that humbleth himself shall be exalted.
In the beginning we see that Job is going to God on behalf of his children in case they have sinned. No mention that he is repenting of his own sins. Sure sounds like he trusted in himself that he was righteous and despised others.
The story of Job is about God removing the hedge of protection. Then Job learns how quickly he can become dust.
Also this word "justified" indicates that both are appearing before the judge in a trial when they pray. Satan is the accuser and one is justified before the judge, he pleaded to God to be merciful to him, a sinner. God said, I can do that.
The other one exalted himself, look at me, look at how great I am. God said, I can do that and told Satan to look at Job and let's find out how great he is. As a result Job was abased.
But he learned a really valuable lesson, he can pray to God and do great things. He is no match for Leviathan, but God has no problem handling Leviathan. We learn that God loved and valued Job. All Job needed to do was ask God for help in taking down leviathan and God would have been there in an instant. So then, we see once Job has learned this lesson he becomes much richer spiritually than he was before.
if he had fault in the middle of the book, in the midst of his trials, Job certainly came back to the right path, having taken to heart the rebuke of Elihu and of God. when God speaks to him, Job answers in all humility, confessing he had spoken in ignorance ((thread-relevant: agreeing with Elihu's criticism)), despising himself and repenting. Job is justified before God, and perhaps an important aspect of why, is that when he faced God, he did not do so with pride. equally important in this aspect of the narrative, is that pride, that is, self-justification ((in re: Elihu's singular criticism of Job's demeanor)) is the specific thing that God's scathing pronouncements to Job target. who are you to question Me? God asks -- and Job, righteously, answers i am no one, i spoke in error, i clap my hand over my mouth