This was not the issue with the pharisees... that they obeyed God's law too legalistically. It was because in public they were pious and lacked humility, whilst behind closed doors they were another. They were jealous of Jesus, and were more concerned with being outwardly self righteous than really knowing God closely- one on one when no one else was looking. Because they held tiny societal taxes and rules in higher regard than the word of God Himself..
In this article it's explained more clearly.
What’s So Bad About The Pharisees?
Ryan Goodwin
07/18/21 - Attitude
Were The Pharisees Condemned For Being Too Righteous?
Some would say that Jesus condemned them because they obeyed the Law of God too strictly or too closely. But where does Jesus ever say that? Where does God ever condemn people for being too good? What verse leads us to believe that obedience is a bad thing? When did God say to the Pharisees, “Hey! Loosen up, guys. If you keep taking my words so seriously you’re going to end up lost”? So what are the reasons that are actually given in the Bible for their condemnation?
They were condemned for blatant hypocrisy (
Matthew 23:3).
They placed their human traditions and customs ahead of scriptures, in violation of them (
Matthew 15:3).
They were self-righteous (
Luke 18:9).
They served God for human praise and recognition (
Matthew 6:1).
They were condemned for a failure to recognize truth (
Matthew 21:27).
Pharisees wielded their power to hinder the faith of others (
John 12:42).
Far from being condemned for obeying the Law too closely, they were actually called by Jesus for not obeying the Law correctly. A part of His condemnation was due to the fact that they chose to ignore certain areas of the Law (justice, mercy, and faith in
Matthew 23:23). Jesus considered every part of the Law to be important, even tithing.
“Hypocrites!”