Where did the Pharisees' righteousness come from? It came from keeping Halakha, the Jewish oral law. Our righteousness, however, has to be a combination of that which is imputed - the righteousness of Jesus Christ - as well as that which is maintained by us through keeping the law of God after conversion. Jesus says that from God's law nothing would pass.
In terms of a principle, which subsequently landed them in such trouble, the Jews acted upon an uninspired interpretation or extension of the principle of holiness or sanctification. There is no doubt that they were a sanctified people. The Bible makes that clear:
For you are a holy people unto the LORD your God [Holy means "sanctified" or "set apart"]. The LORD your God has chosen you to be a special people unto Himself above all people that are on the face of the earth. The LORD did not set His love upon you nor choose you because you were more in number than any people, for you were the fewest of all people. (Deuteronomy 7:6-7)
The Pharisees extrapolated on this principle and in their zeal got themselves into trouble. Their basic fault was in considering themselves to be superior to others. Yet, God's Word plainly shows that there is only one law for both the Israelite and for the stranger (Exodus 12:49). All are judged against the same standard, by the same law. All are judged against the righteousness of God. Thus, we can understand that, in one sense, there is only one class of people on earth - sinners in need of deliverance from bondage to Satan and to sin.
I Corinthians 1:26-30 is the New Testament equivalent of what God says in Deuteronomy 7. In the church there is just one class of people - rescued sinners who are justified and are by grace through faith under the blood of Jesus Christ.