And seriously; I'm not saying her arc is perfectly written. It's lazy and hamfisted, because they're rushing this season (and arguably last season too).
But the turn last episode was where they have been taking her, this entire time, and that's been in the air since Season 2 or so. It isn't out of nowhere; it's the culmination of her entire arc. Those of you shocked by this are like Tyrion, who put their trust in the wrong leader. The rest of us are Varys, and kept ourselves objective, rather than blindly backing that one choice.