I personally find the idea that (very specifically) D&D's magic system could have evolved...well, patently ridiculous. It is far too overwrought and laden with hermetic magic expectations to be an evolved system.
But that doesn't mean I don't think supernatural power can evolve.
As an example, one explanation I've come up with for the nature of dragons is that they could actually be an "invasive" species from a different reality. One that is far harsher than the mortal world. There, dragons almost never survive to "ancient" status. Many are lucky to survive long enough to lay their eggs. Even their innate strength and magic merely ekes out an existence in this dangerous native plane.
But then they came to the mortal plane. A place where, by comparison, almost nothing is as scary as a dragon. Where they live longer (perhaps a secondary effect, e.g. there is just "more magic" here and this affects their lifecycle.) Death to ordinary predation is rare, and only a few individuals make it from Dragonworld to the mortal plane, so population numbers remain low but stable. The exceptionally long-lived and intelligent dragons can thus live lives of opulent luxury, and even should their numbers fall due to mismanagement or hunting, new blood acquired from Dragonworld ensures the species survives.
That's the kind of "evolved magic" I look for. Not spell slots or daily spells or even "spells" in the usual sense. Magic in D&D is too chained to the spellcasting mechanic, and that mechanic just doesn't make sense as something a non-sapient animal would evolve over geologic time scales.
Edit: As for how magic works or came into existence in Jewel of the Desert...that all depends on what kind of magic is in question. Divine magic doesn't really "evolve," but people can learn to use it better, in part by following the lives and doctrines of "saints," prominent individuals of the faith. Primal magic is mostly known from the spirits themselves, so it's...not exactly "evolved," more a negotiation between wildness and methodical effort. Wizard magic is academic, and thus grows by careful experimentation and imitation of other types of magic. Bard magic is unstructured and spontaneous, like jazz. Genies and dragons and devils and other types of beings have innate magic which...just is, it has little in the way of formal rules, but sometimes people can master more discrete/formalized magic powered by that raw elemental magic.
Waziri (Wizard) magic has probably evolved the most, but it's also the most difficult to work with. Poorly-made spells can cause horrific damage. Hence, even the most wild Waziri tend to be very methodical. It gives them a love/hate relationship with other types of magic. They long to learn how to do new things. But they also (often) look down their noses at non-Waziri magic as unthinking or primitive. There's also some pride in it being purely the product of mortal minds, rather than a spiritual gift or innate power.