There's a phenomenon in fiction and film that I like to call "villain creep."  Villain creep is when an antagonist, whether they are the primary opponent of the main characters or a flunky / associate, evolves into an ally and perhaps even becomes one of the protagonists.  Villain creep often occurs when the antagonist reveals that all their actions have actually been in service of fighting even a bigger threat.  Differences are put aside ... and never quite picked back up.  Villain creep isn't the same thing as a pragmatic antagonist temporarily aligning with the heroes to solve a single problem, then returning to his/her roots; it's a permanent (or at least long-term) transformation.

It's easy to see why villain creep occurs.  For a character to be more than a cardboard cutout, they need to have valid motivations; in novels with multiple points of view, that sometimes means stepping inside their brain.  The writer begins to identify with them; so does the reader.  And sometimes the evolution makes perfect sense with the villain's goals.  It's the smart writer who lets the plot move in accordance to the characters.  On the other hand, it's also easy for a writer to sympathize too much with a character they've developed so deeply.  When that happens, villain creep infests the entire plot.  No matter how unsavory that new antagonist seems, they're probably going to end up helping the hero out eventually.

Villain creep happens in television for additional reasons:  viewers get attached to the actor (especially an attractive one); or the writers like working with the actor and want to give them a greater role.  (Of course, this doesn't explain incidents like the evolution of Aneela in Killjoys, because she's played by the exact same actress as the protagonist Dutch.  If this sounds confusing, it is.)

This isn't to say that villain creep is a bad thing.  (It had better not be, because I'm kind of addicted to it, myself.)  There is something deeply satisfying in watching a character we've slowly come to admire "see the light" - and it also makes breathe a certain sigh of relief and shake off the guilt we may have felt for sympathizing for him.  Handled right, the surprise has the perfect punch.  But when used again, the impact slowly lessens.  So the best way to incorporate villain creep is in moderation, and perhaps in combination with movement in the other direction:  protagonists turning coat and joining the other side.

Is hero creep a thing?  Certainly not to the same extent, possibly because we all like to think we're the hero of our stories, not the villain; watching those we identify with become the enemy is unsettling.  But every now and again, it's a good reminder that life is complicated, and people even more so.