There is a pretty big gaffe in the writing for that mission, it has to be said. When you first arrive at the Heretic station and discuss with Legion what you should do, Paragon Shepard's dialogue option is "Rewriting is unethical." And then she goes and does it anyway. Never really sat right with me. The whole quest shows up the failings of the Paragon/Renegade system, but that was the most awkward part of it.
And I killed them, incidentally. My Shepard was pretty much always Paragon, but I wasn't comfortable with the idea of brainwashing sentient beings. If the quest had been about, say, a colony of human cultists, I don't think people would have been so willing to rewrite them.
Also, think about the same situation on a small scale. Imagine if, after getting to know Legion for a while, he decided to join the Heretics in the hope of not getting killed by the Reapers. It's much harder to justify brainwashing one person than millions, because the consequences are much more immediate and personal. The Heretic Geth as a whole are just that on a bigger scale, so killing them seems the much more moral option to me.
Come to think of it, what you're doing if you rewrite them, to all intents and purposes, is Indoctrinating them. You're just doing it so that they'll stop worshipping the Reapers rather than join them. And I think we can all agree that Indoctrination is a Very Bad Thing.