Arguments of the form, "Person did X. Imagine if they had done Y! (Where Y is some obviously unethical thing.)" are fallacious and they lead the discussion to useless dead ends. The point is that the person did do X, and NOT Y.
I have policies at my workplace that disallow something because it's impractical to judge every single situation and then have to deal with the gray area.
At Google, someone once disruptively modified the root permissions for the entire company-wide monorepo to show off that the permissions scheme was fallible. They were left off with a verbal warning, even though on paper they massively abused their position, and could have made the point without actually doing it.
The engineer in the OP took a much smaller action, that was closer to the scope of her actual duties, but was punished more severely.
It's exactly applicable. If you violate say, finance reporting laws (KYC) then you've violated finance reporting laws. If you've added unauthorized code to an internal tool, well, you've added unauthorized code to an internal tool.
And had it been part of a security disclosure, well, that might be different (did they try other disclosure avenues?), but pushing a political viewpoint isn't. Imagine instead if the employee had added the message "Trump 2020" - how would you feel about that?
Would it have been fine if she added a message to say "Affirmative Action is racist" when people browsed information about Proposition 16 on the 2020 California ballot? Sure, she definitely has the right to spread that message on her own time. But adding this message is definitely breaching expectations of professionalism, and abusing her developer role to spread a personal political message. And given that Google/Alphabet is widely suspected of political bias, I it's fair to let go of employees who cannot refrain from modify software to advance their political views.
Sucks but seems logical to me.
That's unrelated to the claims of spying and illegal procedures of course, that the new article claims. Very curious to see what they did that was illegal / what kind of spying they would have done. But right now its just claims.