As a trauma specialist who has worked with many dozens of people who developed a pattern of tolerating abuse in their early teens, I really appreciate the delicate balance you are navigating between offering protection and guidance to your daughter and not vilifying another child who's obviously struggling. Your instinct not to create a power struggle is a wise one: Even if you could successfully cut it off for her, she would miss out on the chance for her to learn how to teach people how they are allowed to treat her.
Just because you don't need to do it for your daughter, though, doesn't mean she should do it alone. If you set her up with a therapist who is both seasoned enough to be helpful and young enough to be credible on this issue (in your daughter's eyes), that allows her to learn some much-needed skills, and keeps you from creating a situation where your daughter feels she has to defend her friend to you, when what she needs is to notice the effect of that friend on her. A group therapy situation or other peer support group is another place where your daughter could get both the reality check and the support she needs.
One more recommendation is a terrific book called Stop Walking on Eggshells. The only thing I don't like about that book is the diagnosis of the other person (BPD is not the only diagnosis that involves some of these behaviors); but the book does do a good job of helping friends and loved ones of a struggling person to focus on their own self-care while still having compassion for the person who is prompting a need for boundaries. This book is not for middle-schoolers: This would be for you, to give you a language for offering your daughter some skills, and also (very challenging thing) to examine whether there are places where you may be modeling too much tolerance for unacceptable behavior. That may not be happening at all, but if so, it's important to remember that our kids may get verbal permission from us to take care of themselves, but if they don't see us taking care of ourselves, they don't really believe it's okay for them. https://www.amazon.com/Stop-Walking-Eggshells-Borderline-Personality/dp/1572246901