Yes - I had this exact situation with my DS when he was at school @Hugga but during Covid, when they were in bubbles at school and so you couldn't be excused to go to the loo, the teacher had to radio a colleague to come and get you and stand outside the loo whilst you went, to make sure you didn't come into contact with another bubble. It was insanely stressful and so DS wouldn't eat or drink anything after 6am each day, which made the problem worse and worse.
He had an overactive bladder which caused constipation, anxiety and ultimately school refusal. The school were really helpful and accommodated this. He did his GCSEs in a side room which had a loo attached so he could go whenever he needed to without worrying.
Oxybutynin was a great help. He also had private counselling which really helped. He moved up to sixth form and so that made it easier because he was in and out of school a lot more (and did one of his A levels remotely) so typically each period of time in school was shorter, the loos were more accessible. It was still a major factor every day to think when the loo breaks would be, could we ideally stop off at home to have a wee there.
Even now when he's fully better and can do things like full day field trips to places in Snowdonia with no loo at all, he still plans his loo trips carefully. I make sure he knows on any long car journey we can stop at any time to find a loo.
Can the school support your DD in coming in for part sessions? That's how we rebuilt confidence whilst the medication was taking effect.
The only thing I'd add, although I would found this no help whatsoever at the time, is that in hindsight I'm glad this happened whilst he was at school and not at uni (if it had to happen at all). It would have been an absolute nightmare having to try to manage this at a far distance, and it was extremely stressful as it was. Just writing this post has really taken me back to that difficult time. Help is out there - take all of it, make sure she drinks plenty of water and don't underestimate the impact on your own wellbeing.