One of the dominant theories for how eukaryotic organisms evolved (and by extension multicellular life) is by incorporating viruses and other prokaryotes internally and there's evidence a variety of viruses permanently entered the gene pool of several animals that were theoretically naturally selected for. It's less a branch and more a mobius rat's nest.
But that's no different how the rest of biology works. A parasite like Giardia is relatively just a dumb machine brute forcing itself through my immune system.
It's very likely an invariant of complexity. Trade offs (and friendly turtles) all the way. And of course evolution doesn't optimize for QALY at all. So it's not surprising that it hasn't really spent much resources on closing the gap. And now we try to do it because we do find it a better goal than "just" thriving in every imaginable niche on whatever complexity it's possible. (We want to maintain our complexity plus occupy more niches.)
Viruses are just replicators. Grey/Green/Brown/Bio goo. They are just dumb machines made by brute-forcing (fuzzing) more complex machines' immune systems.
Viruses might be a different branch on the RNA-replicator tree. Probably when the first replicators started some found - again via brute-forced mutations - that there are some replicators that they can take advantage of to replicate themselves.
And it just seems that closing this security hole is neigh impossible as long as we don't start to seriously tinker with that low level of "life" (eg. cellular machinery, transport, nucleus, messenger and transcription security).