One interpretation is that Jesus only said the old laws must be practiced was to show the hypocrisy of high ranking religious officials.
He also said it BEFORE he said the old laws are null. He was a human being breaking against the religion he was raised as, probably wasn’t a decision made overnight.
Also those who wrote his story down would have also been going through a similar crisis of breaking old habits they grew up with, they might have put words in his mouth.
Anything written 2 thousand years ago must be taken with a grain of salt.
I’m not a christian. I’ve explained my religious beliefs before here But I don’t think I’ll do so again because it’s not worth the ridicule and I don’t have a great desire to explain myself anyway.