This is one of the weaknesses of the law that Jesus came to improve on with Grace.
The people obeyed the law for fear not as a sensible voluntary obligation. People will stay away from sin only because they are afraid of the consequences of the law not as a moral responsibility not to sin.
That is how this matter of the law had eaten so deep in the lives of the reigious leaders hence the reason why they were so upset with Jesus contravening the law instituted for the sabbath.