Well, the way I see it, the Yeerks and the Gedds would have had to evolve together. The Yeerks could not have evolved the ability to control minds without having minds to control during the process, and the Gedds could not have evolved to be the barely-conscious creatures that they were without something controlling them.
The way I see it, their relationship is actually advantageous for both species, at least from a purely evolutionary standpoint. The Yeerks get large, mobile bodies to control, whereas the Gedds get the benefit of the Yeerk's intelligence without having to evolve brains of their own.
So maybe at first, the Yeerks have the ability to control only a few basic motor functions. Maybe they start by latching onto the outside of the skull and just poke the Gedd in the direction the Yeerk wants it to go, more like steering a horse than mind-control. Then, as Gedds and Yeerks both become more and more dependent upon one another, the Yeerks get better and better at "steering" the Gedds, eventually entering the brain itself. And the rest is history.