The OP's question perfectly illustrates the self-deception of legalistic approach to righteousness.
Paul could truthfully say )Phil 3:4-6) that he kept all the Jewish feasts, was circumcised on the 8th day, of the tribe of Benjamin, ate only kosher foods, washed his hands at all the right times, prayed the right prayers at the right time, etc, etc. Paul was very proud or his piety and righteousness!!
HOWEVER, he was (Titus 3:3) also a murderer, persecuter and hater of God's people!! His very pride in his own righteousness was blinding him to his great failings and sinfulness.
This perfectly shows that legalism is blind because it focuses on self and not on Christ (Col 3:1-3, Heb 12:2, 3) and so is extremely deceptive. Paul could not see that he was keeping part of the law well but it main point, love and a change of heart (Deut 6:5, 10:12, 16, 11:18, Ps 40:8, Jer 24:7, 31:33, 34, 32:38-40, Eze 11:19, 18:31, 36:26) and NOT mere regulations (1 Sam 15:22, Ps 40:6-8, 51:16, 17, Prov 15:8, 21:3, Isa 1:10-17, Jer 6:3-6, 20, Hos 6:6, Micah 6:6-8).
Thus, while Paul's pharisaic legalism gave an outward piety, his heart was wicked and deceitful above all things (Jer 17:9).
In Matt 23, Jesus pronounced seven woes against such pharisaic legalism, for example:
- V23, 24 - Woe to you, scribes and Pharisees, you hypocrites! You pay tithes of mint, dill, and cumin. But you have disregarded the weightier matters of the law: justice, mercy, and faithfulness. You should have practiced the latter, without neglecting the former. You blind guides! You strain out a gnat but swallow a camel.
- V24, 25 - Woe to you, scribes and Pharisees, you hypocrites! You clean the outside of the cup and dish, but inside they are full of greed and self-indulgence. Blind Pharisee! First clean the inside of the cup and dish,f so that the outside may become clean as well.
- V29-32 - Woe to you, scribes and Pharisees, you hypocrites! You build tombs for the prophets and decorate the monuments of the righteous. And you say, ‘If we had lived in the days of our fathers, we would not have been partners with them in shedding the blood of the prophets.’ So you testify against yourselves that you are the sons of those who murdered the prophets. Fill up, then,g the measure of the sin of your fathers. You snakes! You brood of vipers! How will you escape the sentence of hell?