It isn't all that big of a jump to imagine maggots, which clean up infected wounds on live animals, taking a step to eating live flesh rather than just the dead stuff. Much as ox pecker birds which eat ticks and maggots on large animals will also peck wounds to keep them open in order to drink the blood.
Probably less a eureka moment as a e...u...r...e....k....a few million years! Especially since some bot flies first catch a smaller fly, which they then use as a courier to carry their egg to the intended target!
The cordyceps isn't just for ants. In the tropics there is just about one for every insect group and type. Did you know that there is a parasitic fungus that infects flies in the UK? We had two or three on my parents' patio door, up at about eye level, complete with dead fly and a burst pattern of spores on the glass.
en.wikipedia.org