The problem is that is clear from context that Paul is indeed talking about the Law of Moses, which is decidedly a Jewish law. And the notion of "boasting" is perfectly consistent with what is essentially an ethnic argument, precisely becuase Paul can be read as addressing the boast of the Jew, who thinks he is ethnically privileged. In fact, what Paul has written in Romans 2 suggests that he is indeed dealing with such a boast, not with the boast of the morally self-righteous with no reference to matters of ethnicity:
But if you bear the name "Jew" and rely upon the Law and boast in God,..
And so they did (boast that they were Jews), and that was the problem--but only part of the problem. That isn't really what Paul is setting out to prove or demonstrate. That is not the purpose of his epistle. His epistle revolves around the various aspects of soteriology.
So, keep that fact in mind. It is very important to the understanding of this chapter.
Secondly, keep in mind that this book, even chapter two is written to believers. It doesn't matter whether or not they have a Jewish or Gentile background. They are Christians, believers, all one in Christ. All of Paul's epistles are written to the saved, not to the unsaved, not to Israel. Take a look:
Romans 1:7-8 To all that be in Rome, beloved of God, called to be saints:
8 Grace to you and peace from God our Father, and the Lord Jesus Christ. First, I thank my God through Jesus Christ for you all, that your faith is spoken of throughout the whole world.
--They are the beloved of God. (NT believers)
--They are called to be saints (NT term)
--Their faith is spoken of throughout the whole world (the faith of Christ; the faith of the gospel of Christ).
This is an epistle written to the saved, to believers in Christ.
With that in mind Paul writes
about the Jews hypothetically addressing how they act. There are no Jews in church at Rome. The church consists of baptized believers. The nation of Israel will never read this epistle. It will not reach the OT canon. Thus the conversation recorded in chapter two is all hypothetical. It is about how a Jew would react if he were addressing a Jew. Keeping that in mind, here is the outline of the first part of the book.
In chapter one Paul addresses the Gentiles and demonstrates that all Gentiles are under sin, and have incurred the wrath of God. In verse 20, he plainly tells them "they are without excuse." They are condemned.
In chapter two Paul addresses the Jews and tells them, mostly through a hypothetical conversation, that they also cannot escape the wrath of God. Their adherence to the law, any law, will not gain them brownie points with God. They need more than that; much more than that. They need justification without the works of the law. They are condemned by the law; the purpose for which the law was given. The law cannot save; it can only condemn and show us our guilt. Works do not save. Paul shows the Jews that they too stand guilty before God.
In chapter three Paul sums up these first three chapters (this first section) by demonstrating that both Jews and Gentiles are condemned. "For all have sinned and come short of the glory of God." One of the most forceful descriptions of the natural man is given in Romans 3:10-18. It makes no difference whether an unsaved man is a Gentile or a Jew, he is still unsaved and falls into that description. There is no ethnic elimination here. Rather it is ethnic inclusion. All are condemned by the law. Their only answer lies in Christ.
Romans 5:1 Therefore being justified by faith, we have peace with God through our Lord Jesus Christ: