Perhaps the answer to the question depends upon the audience being addressed.
Matthew has been called the gospel to the Jews.
Matthew wrote his gospel to convince fellow Jews that Jesus was the messiah foretold in the Old Testament.
Scholars surmise that the gospel was written for skeptical synagogues in Israel.
Matthew quoted Jesus:
“Don’t think that I came to abolish the Law or the Prophets. I did not come to abolish but to fulfill. For truly I tell you, until heaven and earth pass away, not the smallest letter or one stroke of a letter will pass away from the law until all things are accomplished. Therefore, whoever breaks one of the least of these commands and teaches others to do the same will be called least in the kingdom of heaven. But whoever does and teaches these commands will be called great in the kingdom of heaven.
Matthew 5:17-19 CSB
His purpose, to convince his audience that Jesus was the Great Prophet in the likeness of Moses
“The Lord your God will raise up for you a prophet like me from among your own brothers. You must listen to him."
Deuteronomy 18:15 CSB
Matthew was presenting Jesus as the New Moses, and the fulfillment of the Hebrew scriptures.
Why Jesus even added to law (the beatitudes).
On the other hand, the gentiles would find the law restrictive and binding. Paul would present the Law differently. The Gentiles were free from the law and need not submit to it.
Rob