Just because Mahayana and Vajrayana were not taught by Gautama doesn't mean they're wrong or anything like that. A very good example is Bön which has many teachings from the Prajnaparamita up to Dzogchen, still, it accepts no connection to Gautama. Does that mean that the Bön Prajnaparamita is incorrect while the Kagyu Prajnaparamita is correct? And I'm not talking about the quality of the translations.
I take the position similar to Huseng's: it is possible to see the basic ideas in the agamas/nikayas of what has become Mahayana. But that doesn't mean Gautama himself literally taught Mahayana. Which again doesn't mean it is not correct Buddhism, in the meaning and content.
Let me copy this text from Sthiramati that once existed on Anders' website (Leaves from the Buddha's Grove) but now it's hard to obtain (found here
Entering the Great Vehicle [Mahayana]
[Q] Now we may desire to penetrate the meaning of 'Entering the Great Vehicle [Great Vehicle]'. What is the meaning of 'Entering the Great Vehicle'?
[A] I wrote this text for those who want to get rid of the cause of suffering. But you must also know that there might be those who approach a lax spiritual friend and take up a wrong and partial opinion as the Dharma. Then the newcomer might formulate a heretical view and, because of wrong mental application, be unable to penetrate to the True Meaning, unable to know the Enlightenment of the Buddha, and have doubt about his sayings. One who disparages the (Buddha's) holy sayings will then destroy the True Dharma, and have a great deal of evil retribution. As the Blessed One said, "the result of disparaging the Dharma is more heavy than the five grievous trangressions (killing mother, father, arhat, causing dissension in the Sangha or making Buddha bleed), and will bring immediate retribution. Because life in the downward paths is a long duration, the ripening of suffering will be experienced for a long while." And as the Sutra verses say:
"One who slanders the Dharma of the Great Vehicle goes to the lower states of being. This person experiences the ripening of his action and its true nature should be told. He's born deep in hell, and his body burns in great flames; the great torture of his incineration is always the result of sinful action. A blazing iron plow - for five hundred lives - rolls on the top of his tongue while the remainder of his body is struck with pain. If he manages to escape hell, he will still experience other forms of evil retribution and all his senses will be continually non-functioning and polluted; he'll never hear the sound of Dharma. In the exceptional case of one who happens to hear the Dharma, it will again be that he will slander the Holy Dharma,and because of this he will go back to hell."
So all those defaming the Dharma should listen here. You should maintain an attitude of doubt toward the Great Vehicle. Just like Aryadeva says in verse:
"One who has little merit will not even feel doubt about the Dharma. But existence is shredded by the mere presence of doubt." - Catusataka 8.5
If one has doubt having heard all the fundamental teachings of the Great Vehicle, one's intellect will penetrate the subjects and be open to Enlightenment. One who has become open to Enlightenment will [then] simply bring about trust in the teaching, which will lead to further joyand happiness. One who brings about this joy and happiness will obtain the insight brought about by listening, pondering and meditating on the Dharma. One will then progress all the way to total understanding of the Awareness of all States [of being], just like the Buddha.
Thus, we have those who denigrate the Great Vehicle and will fall into the lower realms of being, and those who generate all good actions because of the Great Vehicle. One will thus decay or grow depending on their association [with Great Vehicle]. If one's desire is for Insight, one will travel the path to Enlightenment. It is the same with all beings, since they all have this ability equally. If Enlightenment were separate from the capacity of sentient beings, then the path to Enlightenment would be unobtainable. But, from the realm of all beings comes the Enlightenment of All Buddhas. The Ven. Nagarjuna, in verse, says:
"It doesn't descend from space, nor does it arise from the ground. Rather, the direct perception of Total Enlightenment only happens in those having [first] encountered unskillful emotional states." - Suhrllekha 116
Now this treatise is about entering the Great Vehicle. But what sort of entity is this thing called the Great Vehicle? The collection of scripture known as the “bodhisattva basket” is the Great Vehicle.
One may object that the Buddha spoke of neither the three vehicles nor of the Great Vehicle. However, both of these were identified by the Buddha with the term “three baskets of the doctrine” (tripit.aka). As it is said in the Bodhisattva-pitaka-sutra:
“The Buddha addressed Ajaatasatru, ‘Son of good family. There are three kinds of baskets. Which are these? There is the disciple’s basket, the private buddha’s basket, and the bodhisattvas’ basket. Son of good family, we identify the term “three baskets” only by means of the Great Vehicle to be studied by all the bodhisattvas, not by means of the vehicles of the disciples or of the private Buddhas. Thus we call it the “three baskets”. Why? The expression of the dharma concerns all of the three vehicles, and this is why it is called the “three baskets”, yet only the dharma spoken to the bodhisattvas reflects the capacity to the practice of the three vehicles, so it is terms the “three baskets.”’
“’Son of good family, there are individuals who have the capability to train in one of three ways: those undertaking the disciples’ training, the private buddhas’ training, or the bodhisattvas’ training. Disciples do not study in the vehicle of the private buddhas since they are unable to penetrate its meaning. Likewise, private buddhas cannot penetrate the bodhisattva vehicle. Only the bodhisattvas are capable of studying others’ vehicles, yet they do not obtain realization in these paths but by means of the bodhisattva vehicle. Thus, theirs is the profound enlightenment of the Dharma to be practiced by the bodhisattvas. Because it has this significance, the bodhisattva vehicle is terms the “three baskets” and not the other’s vehicles.’”
Other scriptures also elaborate the following exhaustive distinctions, which I am now going to summarize, so please listen. You may think that the Great Vehicle is not part of the three baskets. Then, the three baskets consist of: the Enumerated Discourses, the Middle-length Discourses, the Long Discourses, and the Scattered Discourses, constituting the one hundred thousand plus verses of the first basket; the discipline and the higher dharma, composing the two hundred thousand verses of the second basket; and the complete cultivations composing the third basket. This, in fact, is not to be identified with the three baskets. Why? Because many other scriptures would not be considered the word of the Buddha. Yet there are still other scriptures than those included in the discourses, the discipline, and the higher dharma. There are the works of the “scattered basket”, the Tiger Scripture, the Womb Scripture, the Advice to Kings, Prior Births of the Buddha, the Dependent Origination for Private Buddhas -- altogether eighty-four thousand baskets of doctrine. If only the three baskets are the word of the Buddha, then we would have the problem that not everything collected by the venerable Ananda would be considered the word of the Buddha. Thus, we should identify all of them with the term “basket”, and conclude that there are over one hundred thousand baskets of the dharma.
One may object that the Blessed One has previously said, “After my Nirvana, in the future there will come many who will sit around and argue, ‘This is the word of the Buddha, this is not the word of the Buddha.’” In response to this anticipated circumstance, the Tathagata has sealed his doctrine with the seal of the dharma. “If the meaning of a scripture is in harmony with the discourses, if it is in accord with the discipline, and if it does not contradict the nature of reality [dependent origination], then that scripture may be termed the word of the Buddha.”
Our response to this objection is that the Buddha certainly did not apply these criteria to the bodhisattva vehicle while exempting the disciple’s vehicle. The Buddha’s word is not dissimilar in either case but indicates a single nature to be sealed by the seal of the dharma. Now, as to your means of comparison between a scripture proposed as the word of the Buddha and the three baskets, is it done by means of the letter of the texts or by the significance? If it is by the letter, then it is impossible that any of the twelve sections of scripture should be the word of the Buddha, since they all have different verses, sections, and sentences. But if the comparison is performed by examining the meaning through reason which does not contradict the nature of reality, then a meaning which harmonizes with the significance of discourses and is characterized by reality accordingly demonstrates its own significance. So those discourses which demonstrate the significance of the disciple’s dharma belong to the disciples’ vehicle. Those discourses which demonstrate the significance of the private buddhas’ dharma belong to the private buddhas vehicle, and those discourses which demonstrate the significance of the bodhisattvas’ dharma belong to the bodhisattvas’ vehicle. . . Now the inquiry into the perspective equal for all the buddhas in the universe (as many as are particles of dust) is also the dharma to be received from an excellent spiritual friend. It is thus the complete Great Vehicle and termed the expanded discourses - immeasurable, unlimited, and not part of the disciples’ dharma. Its meaning is very profound, and accordingly all the dharma to be cultivated by the disciples is found minutely included into the path of the Great Vehicle. It is great blessedness and this is what is meant by “in harmony with the discourses.”
Now we should discuss the phrase, “in accord with the discipline.” The holy path of all the three vehicles equally destroys desire, anger and hatred, which is the reason it is identified as discipline. Now the discourses discriminate cause and results, whereas the higher dharma discriminates the characteristics of real events, yet they both destroy the mental and emotional defilements. The Great Vehicle also speaks of the elimination of all evil events, the defilements of desire, anger, and ignorance. The Buddha taught the disciples to purify their own three varieties of action - body, speech, and mind - and called that the discipline. To the bodhisattvas, he taught them to purify their own three varieties of action - even going as far as the accomplishments of Buddha - by grasping and completing the perfection of virtue. Morality itself is to be grasped by the bodhisattvas. By generating the thought of awakening for all beings they are able to obtain the fruit called absolute truth. Thus the Great Vehicle is in accord with the discipline.
Finally, it does not contradict reality. As none of the three vehicles speaks of the contradiction of the twelve parts of dependent origination, neither does the Great Vehicle.
So, one who investigates well this issue realizes that the Great Vehicle is completely in accord with the threefold seal of the dharma. Of course, if one does not well investigate it, then neither the Great Vehicle nor any of the three vehicles is accepted. And one deprecating the Great Vehicle then commits the gravest of faults.
If you now maintain the Great Vehicle to be the word of Mara, and not that of the Buddha, then we must reply that in none of the discourses do we truly find the pronouncement that the Great Vehicle is Mara’s word. So, this objection cannot be trusted. If you believe that to call the Great Vehicle the word of the Buddha is like a worm in the body of the Teacher that still feeds on his corpse, then all of the vehicles feed off the dharma body of the Buddha, not just the Great Vehicle. By just this token, it cannot be the word of Mara since only the Buddha is able to express it.
Bodhisattvas have immeasurable, unlimited, incalculable qualities that reach as far as the very hells. Facing Nirvana directly, they still return to the cycle of birth and death through their sympathy for living beings. Here they remain for an incalculable eon and experience for a very long time heroic suffering. You see, the vehicle of the bodhisattvas, the great beings (mahasattvas), is actually the Great Suffering Vehicle. Their search for the highest fruit is inconceivable. They have left behind all the disciples and private buddhas, surpassing their efforts. Fulfilling all the qualities of enlightement, they transcend the stage of the facile “knowable.”
How is the bodhisattvas’ vehicle the Great Suffering Vehicle? Suppose that a person might take a ship across the ocean. On the high seas, an evil wind arises, making the waves appear like mountains. Other countless calamities like this occur at the same time. All of his companions are anxious and develop an overwhelming fear, but the captain has long experience in handling the sails and has the merit of the ability to overcome difficulties. Transcending his troubles, he seizes the great precious gem in the ocean.
The bodhisattva, the great being, is at rest in the sea of birth and death. He does not trust the troubles that are entertained by going down the evil path on account of listening to a poor spiritual friend. During the first incalculable eon, the bodhisattva cultivates the practices associated with the stage of purity and seeks pure liberation. During the second incalculable eon, the bodhisattva cultivates the practices of pure contemplation. During the third incalculable eon, the bodhisattva cultivates the practices of pure gnosis and overcomes the obscurities of the stage of the facile knowable. Therefore, the bodhisattvas’ vehicle is termed the Suffering Vehicle. Completing all the ten stages, he obtains them certainly and clearly. Because of the completion of all practices, he obtains the highest, complete, perfect awakening. Through his cognition of final gnosis, he accomplishes the great accomplishment.