What is “IT” that determines what entity will spring up out of primordial swamp soup and become a virus or a bacterium....you know way back to the very first of those species?
What mechanism triggered a creature to split off becoming a reptile while one became a mammal, assuming both had a common ancestor?
As far as the origins of life, a virus cannot reproduce without a bacteria or eukaryote, and eukaryote seem to have organelles that have likely bacterial origin, so that leaves bacteria is the most archaic life form still extant.
As far as what mechanism can trigger speciation such that reptiles and mammals share a common ancestor, it usually involves small changes in small populations for long enough that successful reproduction with the ancestral population becomes less and less frequent until it becomes unlikely and eventually impossible.
Different stresses on different populations shape them differently. Just look at what the Earth did to the human race. We have blacks skin where we need to filter out sunlight, pale skin where we need to absorb light to make vitamin D, kinky hair where we need to lose heat, excessive hair where we want to conserve heat, lactose persistence in cultures where milk drinking was advantageous that arose by different ancestral mutations in both African cow herding tribes and Northern Europeans.
Mammals arose from reptiles. There are egg laying mammals with primitive mammary glands and fur, mammals without placentas but with pouches, and placental mammals. These are all extant links of the branches that led from reptile to mammals. Far from the links being ‘missing’ they are living among us.