First the passage...
You, therefore, have no excuse, you who pass judgment on someone else, for at whatever point you judge another, you are condemning yourself, because you who pass judgment do the same things.
2 Now we know that God’s judgment against those who do such things is based on truth.
3 So when you, a mere human being, pass judgment on them and yet do the same things, do you think you will escape God’s judgment?
4 Or do you show contempt for the riches of his kindness, forbearance and patience, not realizing that God’s kindness is intended to lead you to repentance?
5 But because of your stubbornness and your unrepentant heart, you are storing up wrath against yourself for the day of God’s wrath, when his righteous judgment will be revealed.
6 God “will repay each person according to what they have done.” 7 To those who by persistence in doing good seek glory, honor and immortality, he will give eternal life. 8 But for those who are self-seeking and who reject the truth and follow evil, there will be wrath and anger. 9 There will be trouble and distress for every human being who does evil: first for the Jew, then for the Gentile; 10 but glory, honor and peace for everyone who does good: first for the Jew, then for the Gentile. 11 For God does not show favoritism.
Those verses I bolded, 6-10, simply do not jive with the message of the apostle of grace, not within this letter nor in his other letters to the early church.
In the next chapter Paul argues from his reading of the Hebrew scripture that all are unrighteous. However, the appearance of Jesus has revealed God's plan of salvation all along. He writes, 3:23 for all have sinned and fall short of the glory of God, 24 and all are justified freely by his grace through the redemption that came by Christ Jesus. In chapter 4 he appeals to the example of Abraham and a psalm of David's. In chapter 5 he makes massive claims about God's plan as revealed in Jesus, 5:18 Consequently, just as one trespass resulted in condemnation for all people, so also one righteous act resulted in justification and life for all people. He goes on and on about God's plan as revealed by Jesus, a completely one-sided plan, it's initiated, continued and finished by God who it love.
Romans 8:32 He who did not spare his own Son, but gave him up for us ALL—how will he not also, along with him, graciously give us all things? ... 38 For I am convinced that neither death nor life, neither angels nor demons, neither the present nor the future, nor any powers, 39 neither height nor depth, nor anything else in all creation, will be able to separate us from the love of God that is in Christ Jesus our Lord.
Romans 11:32 For God has bound all men over to disobedience so that he may have mercy on them all.
He develops this in his other letters as well.
1 Corinthians 15:22 For as in Adam all die, so in Christ all will be made alive.
2 Corinthians 5:18 All this is from God, who reconciled us to himself through Christ and gave us the ministry of reconciliation: 19 that God was reconciling the world to himself in Christ, not counting men’s sins against them.
Ephesians 1:9 And he made known to us the mystery of his will according to his good pleasure, which he purposed in Christ, 10 to be put into effect when the times will have reached their fulfillment—to bring all things in heaven and on earth together under one head, even Christ.
Philippians 2:9 Therefore God exalted him to the highest place and gave him the name that is above every name, 10 that at the name of Jesus every knee should bow, in heaven and on earth and under the earth, 11 and every tongue confess that Jesus Christ is Lord, to the glory of God the Father. Colossians 1:19 For God was pleased to have all his fullness dwell in him, 20 and through him to reconcile to himself all things, whether things on earth or things in heaven, by making peace through his blood, shed on the cross.
The question is why has Paul put these words from Romans chapter 2 in his letter if he doesn't even believe these things? We know in some of his other letters he refers to questions he has been asked, but without the techniques we modern english readers are familiar with in our familiar typography today. Paul could not use quotation marks. It wasn't an option in Greek. He did not have any punctuation. Everything was written in all capital letters squished together in the limited space of parchment. There were not even spaces between words. Therefore, his readers, even us 2000 years after the occasion, are left to read critically. Some modern Bible's are typeset to suggest how the argument flows. Some even add notes or headings to indicate their favored understanding. Even the words selected for translation are not unbiased. As my Greek professor liked to say, translation is commentary.
Since not all parts of the Bible are equal, but Jesus, as the best representation of God, gets the final vote, I approach passages like this wearing my Jesus lens. Jesus taught in his sermon on the mount that not everyone who says of Jesus "Lord, Lord" and does miracles in his name qualifies as citizen in his new kingdom. In fact, they might even be evildoers, Matthew 7:21-23. It seems to me that Jesus does not agree with the voice in Romans 2, but rather agrees with Paul's other thoughts in Romans and elsewhere, that it's all grace, God's love realized.
I do not think Paul is contradicting himself in Romans 2, but quoting a religious foil, someone who believes contra Jesus that a good life obligates God to reward the do-gooder. Paul argues against that in chapter 3 saying no one, except Jesus, is purely good. No one can love perfectly. Everyone is wounded, crippled by ourselves and our fellow wounded human beings. As the well attested aphorism goes, hurt people hurt people. As Jesus says, he is the physician who has come to heal the unrighteous, not the self-righteous.
Even in the New Testament, there is plenty there that require discernment, a christianese word meaning "critical reflection." If something in the Bible does not align with Christ and his teaching it's not Christian. It seems like a tautology but most christians reared on an extremely simplified doctrine of biblical inerrancy (every word in the Bible is God's word) fear such critical reading.
A much deeper reflection on Paul's application of the revelation of Jesus in the letter to the Romans, one would have to read a thousand page tome by Douglas A. Campbell, professor in the Duke Divinity School, The Deliverance of God: An Apocalyptic Rereading of Justification in Paul. I have not read it myself, it's a little out of my price range. For a short and free introduction to his thought, see this post at Andrew Wilson's blog, Do You Read Romans Like An Arian?.
This is part 19 of the series, Not everything Biblical is Christian. Part one points out that the words of Satan recorded in the Bible are not Christian doctrine. Part two shows the Sermon on the Mount overruling the cursing of enemies exhibited in Psalm 137. Parts three and four show Moses getting overruled by Ezekiel and Jesus. Part five merely brushes the concept of source criticism. Part six looks at the Old Testament application in the early church: a brief summary of the book of Acts. Part seven looks at how the church has worked this out regarding slavery. Part eight, showed one example of how an unchristian part of the Bible helps tell the Christian story. Part nine asks who would Jesus hate? Part 10 discusses women as Biblically approved spoils of war. Part 11 discusses divorce. Part 12 discusses the imposition of Bronze Age social constructs onto our diverse and complex modern world. Part 13 discusses women as property in the Biblical world. Part 14 discusses dehumanization of people with Biblical support. Part 15 discusses the evangelical culture that tends to proclaim the terrible day of the Lord is around the next corner. Part 16 shows how the end of the book of Job overrules 90% of the soliloquies in the book. Part 17 discusses a Psalm of confession. Part 18 discusses more Psalmist theology.