In regards to Legion, I think most people are forgetting that its actions are essentially due to programming. That is to say, it'll obey its instruction set to the letter.
I like to point out a very good example of one :

Remember her?
For all her good intentions as a "human" she ultimately had to obey the "command instruction" to kill Adama when the situation called for it.
Thus from my point of view, I see Legion as a scout that was sent to look for Shepard whose mission is to infiltrate / insinuate itself into Shepards team and see why is he so effective against geth (in general) while other organics fail. Its the logical thing considering Shepard's unusual methods and penchant for taking on non human team members. Its a risk, for sure since the Geth has no way of determining whether Shepard would take Legion in, much less question it or even let it into the team, but its a gamble with the risk of losing a single mobile unit vs valuable knowledge gained if Shepard takes the bait.
Also like Sharon "Boomer" Valerii, Legion may very well against its will, betray Shepard at some point if the Geth Collective decides thats its in the Geth interest to do so. Or perhaps the betrayal will be due to a sleeper program.
Having said that, just like Adama, even knowing that Boomer is a Cylon, takes her back into the Galactica only because he weighed the pros and cons and found that (paragon path) the gains for having a faction of the "enemy" on his side far outweighs the risk of death or betrayal.
Which is classic Bioware. No matter which side of the coin you get, odds are you can be betrayed but depending on what you do, might just tip the balance of how an individual / faction will react sometimes contary to what it had originally planned.
I took the paragon path myself on this one. I am not to sure if I did the right thing as I learned later that it could lie or withold infomation about itself as you will learn if you talk to it enough. It won't tell you why it choose to use your armor even when you pointed out that there were probably better material on hand to fabricate repairs to the damage it took.