Jesus not only teaches the SotM, he IS the SotM.
If you are "in" the kingdom of God, THIS is what you ARE. "Blessed ARE... Blessed ARE... Blessed ARE you..."
The "bar" of righteousness is raised in the SotM so high, as to be unimaginably hard, even for the most holy ordinary man. It is an impossible standard. Except for one Person.
And that Person is sitting there, giving you the description of his kingdom, the description of the people who fit in there. If you look at yourself, and only yourself, clearly you do not belong there.
If you think you can "make it" in that kingdom by your efforts, you must be a deluded Scribe or Pharisee, or even more self-righteous than one of them. Because "your righteousness must exceed that of the Scribes and Pharisees."
The Mt. of Sinai was a terrifying place. The Law given there was appropriately majestic and awesome; but somehow, to some people it seemed doable--maybe even on account of how dreadful the presentation was. "God is really serious about this; he's pure Justice; he's suited his Law to our frame; I think, with a bit of effort we should be able to shoulder this; and there's the reward as well to consider... so OK, all this we will do!"
In contrast, on this other Mount, the King sits down, all approachable and full of grace, and truth. And you say, "Of course this teaching is the way to live well, and cordially with others, and this is all his kingdom will tolerate, and wait, ow!... That cut went pretty deep." This encounter is just as serious as the first. There are judgments here not only for unloving acts, but unloving thoughts as well. But notice, there's no opportunity given here to promise obedience. You are or you aren't.
You have to answer an unasked question, "Do I want this man as my King?" Listen to his demands! Really listen to them. The self-righteous mind may very well say, "I can handle this." But it can only do so by not actually paying attention to what Jesus is saying, leaving things out, damping down his standards.
Others end up inferring (falsely) that Jesus will accept half-measures--after all, he's reasonable and will surely credit my best efforts. They seem to reason (by leaps of logic) that because Jesus is so approachable, he's susceptible to appeasement, to bribery, to wheedling. They see him as a mere man, and so subject to common limitations brought on by sin. "He should understand why I had to...." They look at Jesus, and they do not see his glory. They do not take him seriously.
Jesus sets the standard for his kingdom, and he keeps the standard himself (insofar as his character is the ideal; not that he stands under rules he imposes on others). When I ask the question, "Do I want this man as my King?" it is a question of devotion. I don't measure up to his standard, but I WANT this man as my King.
If that's not the main thing, if the rules and the regs are the main thing, then one will stumble--either turning down Christ's dominion straight up, or else trying to make it in his kingdom on my own ("Lord, Lord!"). They will never find a place in it.
We who choose Christ's dominion anyway--even though we KNOW we don't have a place in his kingdom by rights, by efforts; we only stay in by his leave and his compassion--we will find a forever place in it. Because we are hearing HIM--hearing his sayings, 7:24, and practicing them however imperfectly. He is the Rock on which we rest, not on our practices. The Rock makes us stay, not the construction.
Belonging to the kingdom isn't easy; he even said so, 7:14. Which is why we simply cannot rely upon ourselves one bit to keep ourselves in it. But the whole point of the Sermon is that we come to him, 5:1, the "preface" to the whole. Those who come, and are devoted to him, are blessed. His righteousness will suffice, when none of ours will. And thus we will, by his grace, start to demonstrate in our lives the fruit of that devotion, the behaviors of true citizens which he describes. Because He wants it, those who love Him, calling Him "Lord" in truth, want it for Him.