Often in fanfiction, a powerful Slytherin family takes Hermione under their wing for their own motives, providing protection. Or a Slytherin professor might secretly look out for her because they see potential in her that others overlook.
Well, it could be that a Slytherin character has developed a soft spot for Hermione and decides to shield her from various threats. Maybe they recognize her worth and skills beyond the house stereotypes. Also, there could be a pact within Slytherin to protect certain individuals for strategic reasons, and Hermione gets included.