I outlined my entire story around the mentor character also being a companion for the protagonist during her quest, but this proved very problematic as it really reduced the agency and shine of my protagonist. I really don't want to go the easy route and just have the mentor killed, that would require me to rework the middle of the story almost completely and the relationship that developed between them is full of potential I want to fully explore and use it to raise the stakes during the climax of the story. Any ideas on how to deal with this in another way?
Usually the mentor isn't as physically capable as the protagonist, being ill or old. The protagonist may have some abilities the mentor doesn't. Perhaps she excels through raw talent. The mentor could also have other matters to attend to (Gandalf), or be captured, or sick, or stranded.
Maybe the mentor is an authoritarian asshole, but very good at passing on the knowledge and skills. But she gets pissed off at (him? her?) and beyond a certain point when she feels she has sufficient skills or the adventure is solidly underway, she just refuses to put up with it anymore and starts disrespecting him/her, diminishing his importance. It could become a rivalry, and maybe she surpasses him (I've decided on him for simplicity's sake). He becomes a passive/aggressive brooding jerk, trying to snipe her frequently, essentially becoming an adversary. Maybe she's always had the verbal skills to humiliate him but didn't do it before because she wanted the training he could provide. But now he keeps trying to treat her as a student when she knows she's well beyond that. He needs the feeling of superiority. She has to keep putting him down to keep him in his place. They do say if the student doesn't surpass the master that the master has failed. It's bittersweet—he must train someone who, if he succeeds, will become his better and make him feel old and washed up. If he has that kind of attitude.
Allow me to point out how the movie Dragonslayer got around that issue. The old, feeble mentor had himself "killed", and the acolyte takes his ashes with him to face the dragon and later throws the ashes into a "lake of fire". The old mentor is then restored. Quite a nice resolution I thought.
I think there is a lot to unpack, regarding the nature of the hero mentor relationship as a storytelling concept, and we could each write essays on our thoughts and experiences on this. but I'll skip that and go straight to simple advice. You can injury/handicap your mentor. If they are great fighter in the middle of a battle have them break their arm or leg, now they can't fight and the hero has to step up, the mentor can still be part of story/journey for the interactions you want, but there is a reason they are stepping down from the heroics. And I say break and arm or leg assuming the mentor's talent is physical combat, if they are Gandalf/a Wizard, have them lose their connection to magic so they can't do spells. If they are a political leader, have them get a really bad sore throat so they can't give speeches... what every area it is where the mentor already shines but the hero needs to shine, make the mentor unable to do it, even if temporarily so the hero has to step up and do it. Again I think there is a lot to discuss in the hero mentor dynamic as a whole, but the simple answer to this question is break their arm.