Like a revolving door rather than any kind of straightforward evolution pathway, according to recent research:
Researchers at the Universities of Helsinki and Lyon and the Geological Survey of Finland found that complex teeth, a hallmark of mammals, also evolved several times in reptiles, prompting the evolutionary success of plant-eating lizards. However, contrary to mammals their tooth evolution was not unidirectional.
The study, published in Nature Communications, reveals that several lizard groups evolved teeth with multiple tips (“cusps”) that allowed new plant-based diets and higher speciation rates — that is, how fast new species appear. Surprisingly, tooth evolution was more flexible in lizards and snakes than mammals, revealing a more nuanced view of tooth and dietary evolutionary adaptations in vertebrates…
The team also found that complex teeth and plant consumption provided an evolutionary advantage, as both traits favoured the appearance of new species. However, many lizard lineages also lost complex teeth to re-evolve the ancestral simple tooth morphology. “This came as a complete surprise,” says PhD candidate Fabien Lafuma from the University of Helsinki, “as complex teeth appear as a critical innovation for both squamates and mammals.”…
Contrary to mammals, tooth evolution was not unidirectional, and numerous lineages reduced complexity over time.
University of Helsinki, “Plant-eating lizards on the cusp of tooth evolution” at ScienceDaily (October 15, 2021)
In short, when researchers actually looked at reptile tooth history, it was hardly a simple evolution tale at all. It seems as if there are plans that life forms can access, perhaps within their genomes. But how do they trigger the needed changes, as opposed to just going extinct?
The paper is open access.