He isn’t questioning the validity of one law. He’s pointing out that strict, literal interpretations are always subservient to common sense context. In general God said to not work on the Sabbath. But if circumstances arise where other needs are more pressing, not only must you do so, but it would be wrong not to as the needs of the ox(sick man) outweigh the commandment about the Sabbath. And he uses literally one of the Ten given directly by God to illustrate that point. We are always balancing competing interests and interpreting anything, even the Ten Commandments, literally, universally, and unflinchingly is not what they’re there for.
He specifically referenced one of the Ten Commandments, not a law created by the Pharisees. And pointedly chose to break it to help a sick man. I think you should reexamine your interpretation of the passage with open eyes.