Although your question skipped a lot of detail, what is there suggests how misogynism could enter through the cracks.
Let's look at your summary, and not unreasonably, assume that what you focus on in it, reflects how you've come to this storyline and where your emphasis and attention is - what matters to you. The point being, what doesn't matter to an author, what they don't love as much or put as much insight into - those often become the stereotypes, filled in by default, because it's quick and easy and their mind wasn't on it anyway.
What we learn about Edward: He's a spy. He works for an organisation. The organisation is fleshed out enough to have a name and goals. What he does for them. He has a sister. Her name. Where she lives. He has an ally in the rescue. He has a maybe love interest. The maybe love interest's name.
What we learn about Lily: Absolutely nothing. (She is a woman living with her brother, at most)
You're in danger of stereotypes - and many stereotypes in this narrative are sexist - simply because it doesn't seem that Lily has any intrinsic interest as a person to you. She's a foil, a trigger for the actions of someone else far more important. She can be filled in by simplified routine outline because Lily isn't a character, she's an object - she serves a role, she isn't presented as being of deep interest as a person.
How to avoid mysogynism? Do the opposite. Flesh her out as a person, as if she is the real hero or centre of focus - which is a good way to ensure you write all characters well. Love each of them. Care about each. Understand each.
Think hard about her, as you would about Edward. Is she as proactive as her brother? Does she just passively listen and think with feminine adoration "how clever he is!" (I hope not!) Does she agree or not, has she picked up things from him or not, what has led her to live with him, what is her inner life like? These and many more. Think about her life, her strong views, her goals and perspectives, where she's been and where she's going, and all that binds it together and makes Lily really interesting, enough that you could write a story about her, not him.
In Harry Potter, as much attention is given to the personalities of the hero's opponents, as to the hero himself - more in the case of some like Snape. Side characters are fleshed out in depth - the caring Molly who unexoectedly leaps to her daughters defense shouting "You bitch!", even the father of the antagonist, his wife, her sister. All lovingly dwelt on before fingers hit keys - and it shows. Ditto most good novels. Do right by Lily, and give her, her own life that's led to this point, not just an object or foil with a light touch of veneer, try to write her story, in this, not just the hero's, and she'll do right by you as a solid balanced character too.