You understood correctly that there is very good reason to doubt that the two events--the Sermon on the Mount and the Sermon on the Plain did not occur as historical events. But the content of both events in the gospels of Matthew and Luke is a totally different matter. The sets of sayings preserved therein are probably from a separately preserved and transmitted collection of the words of Jesus from apostolic times. 

My whole point is to illustrate how the evangelists were very determined to pass down to us their understanding of Jesus, and that intent is wholly consistent with them adopting the literary devices of sermon and a dialogue as non-historical containers for inserting saying of Jesus into the narrative structure composed by Mark. 

Discovery of this, and many other features, of how the gospels are not historical, in our sense of that genre today, DOES NOT destroy in any way our conviction that the gospels reveal truth under the guidance of the Spirit.