You take the "filthy rags" quote out of context. This is something Protestants inevitably do as you are trying to understand the scriptures entirely through your own wisdom and that of those around you, as well perhaps (in some cases) past philosophers. I do not say that Catholics do not do it as well, we are all greatly limited in our wisdom. However, it seems Protestants are, by definition, prone it. The verse you mention does not say that all acts of righteousness are as filthy rags to God, but that those being rendered to him in Isaiah's day were.In context the passage says:
"Since ancient times no one has heard, no ear has perceived, no eye has seen any God besides you, who acts on behalf of those who wait for him. You come to the help of those who gladly do right, who remember your ways. But when we continued to sin against them, you were angry. How then can we be saved? All of us have become like one who is unclean, and all our righteous acts are like filthy rags; we all shrivel up like a leaf, and like the wind our sins sweep us away. Your sacred cities have become a desert; even Zion is a desert, Jerusalem a desolation. Our holy and glorious Temple, where our fathers praised you, has been burned with fire, and all that we treasured lies in ruins. (Is 64:4-6, 10-11, NIV)"
This pertains to a particular historical situation, not to a general condition. The passage appeals to a time when Israelites once had a right relationship with God, when God helped them against their enemies because they waited on him, gladly did right, and remembered his ways.
When they sin against him and did not repent and return to their former state, he abandoned them to the will of their enemies, so that even Jerusalem and its Temple were destroyed. (Isaiah speaks of this prophetically, before it happened.)
It was during that period of continued sin, leading up to the destruction of Jerusalem in 586 B.C., that they had "become like one who is unclean"--they hadn't always been like that. In this state, even the nation's acts of righteousness appeared like filthy rags to God, so he wouldn't help them: "When you spread out your hands in prayer, I will hide my eyes from you; even if you offer many prayers, I will not listen. Your hands are full of blood; wash and make yourselves clean. Take your evil deeds out of my sight! Stop doing wrong, learn to do right!" (Is 1:15-17).
To be clear, while Catholics realize that our good works, whether we are Christian or not, cannot be sinful when done with good intent, we do not teach that we go to Heaven or are justified in the sight of God through works. The Council of Trent stated that "nothing which precedes justification, whether faith or works, merits the grace of justification" (Decree on Justification 8 )
. In other words, God is pleased with goodness, but that does not mean we ourselves are without a doubt pure or destined for Heaven.