She loves Legion with her whole heart, with her soul. They are good and kind and flawed and she looks at them and thinks human, in the same way she thinks it of the Quarians, the Turians, the Asari. Something sentient, something worth respect and care.
The other members of her squad don’t seem to think this. They think the Geth are monsters, but indoctrination and a genocide will make you do almost anything.
Shepard always reminds the crew that the Geth drove the Quarians out but never pursued. They remembered the Quarians that defended them in past, those who cared for and protected them. So when the ambassador gets onto her ship and asks her to hand Legion over to experiment on them. As if Legion was not sentient, as if he was any different from EDI or Joker or Garrus - she punches them in the stomach hard enough to have them crumple and kicks them off her ship.
She has a war to win, but if they think she’ll sacrifice a member of her crew without it being absolutely necessary (Ashley, Thane, Mordin) then they have no idea what they are unleashing.
If they hurt the people she loves, she would show them why her crew survives when whole armies seem to fall.