So if their doctrine was sound, why did Jesus attack them so vociferously? The problem was with the motivation of their hearts. They behaved and believed and prayed like they did to impress people rather than God.
In Matthew 23 Jesus warned the people about the scribes and Pharisees
“They do all their deeds to be seen by others. For they make their phylacteries broad and their fringes long, and they love the place of honor at the feasts and the bests seats in the synagogue and greetings in the market places and being called Rabbi by others. But you are not to be called Rabbi, for you have one teacher, and you are all brothers.” (Matt. 23:5-8 e.s.v.)
It is important for us to understand that Jesus was speaking of one of the most common temptations in our lives to this day. It is easy to desire to be spiritual so we will be respected by people as spiritual. It is easy for us to even pray for God to make us successful in the eyes of other people. This is clearly an abomination to our Lord.
But I find such humble motivation very difficult to achieve. In fact, I it impossible without the help of God. I pray that God will work spiritually and supernaturally in my heart so I will seek success in His eyes rather than in the eyes of men.