Why are Mahayana texts in Sanskrit?
I'm afraid any answer to this is going to be speculative, so not a perfect SE question. Here is my theory:

Most of the early Mahayana texts were written either in Hybrid Sanskrit or in Gandhari Prakrit because their authors were the descendants of Aryans living in the Gandhara region. Historically, that area has always been much more "sanskritized" than the rest of India, see below for my explanation as to why.  So when Buddhism reached Gandhara, it was only natural for the educated locals to write their thoughts about Buddhism in a language that they both spoke and knew how to write - and that was Hybrid Gandhari Sanskrit.

Here is some background information in support of this thesis:


As you all know, Classical Sanskrit is an idealized written form of the language that the original Aryans actually spoke (some modern scientists call it "Prakrit" and other call it "Vedic Sanskrit"). Sort of like Classical Latin is an idealized written form of the language that the original Romans actually spoke.
Originally, Aryans came from Iran and settled in what today is south of Afghanistan, along what used to be Sarasvati river. Then, when the tectonic shifts in Himalayas made Sarasvati change its course and start falling into Ganges, the Aryan tribes started migrating further east, carrying their language and culture with them, and mixing with the indigenous population. This led to a range of dialects emerging along the Ganges, from the purest form of Vedic Sanskrit in the west to the most corrupted vernaculars in the east. This process was accompanied by social stratification, with "more civilized" Aryans on the top and "less civilized" locals at the bottom - this was how the infamous casts or varnas begun.

Sorry about the map labels being in Russian, I drew it a long time ago and don't have time at the moment to fix the labels. But from the overall shape and the colors, I hope you can see the state of Aryan assimilation by the time the Buddha comes on stage. The blue states on the left are more Aryan, speaking almost pure Sanskrit - and the orange states on the right are more the original people, speaking their own languages partially mixed with Sanskrit to form various dialects like e.g. Pali. The region of Gandhara is not highlighted on my map, but it is that area with multiple rivers  to the left of the leftmost Indian state.


There was a big university there in Gandhara, called Takshasila University - and thanks to the proximity of Persian and Greek Empires I suppose this region was a lot more educated and literate than the rest of India, back in the day.
Most of the Mahayana scripts written in Sanskrit (either Hybrid or Gandhari) were discovered at archaeological sites located in the Gandhara area.
Many of the great Mahayana lineages recognized in Tibetan Buddhism, trace their beginning to enlightened masters from Oddiyana which is basically the same area. 
Sarvastivada school left their version of Canon written down in Sanskrit, and we know that Sarvastivada was essentially centered in that same very region of Gandhara/Oddiyana.
Milinda-Panha (Questions of King Milinda) - a late Canonical text whose story is set in Sagala, a city just to the east of Gandhara region, was probably originally written in the Gandhari language.
At least some of the Mahayana sutras only available in Chinese show linguistical evidence of having been translated from the Gandhari dialect of Sanskrit.


All this is to say that ancient people of Gandhara/Oddiyana who wrote Buddhist texts in Sanskrit did not violate Buddha's rule prescribing people to "learn the word of the Buddhas each in his own dialect" - because Sanskrit was a written version of the language they actually spoke.

Then, from Gandhara, Buddhism has spread to other countries including China via the Silk Road, as well as Tibet.