I can see it from both sides.
I work in a Y1 class and even in there the teacher does, to an extent, restrict how often children can go out to the toilet.
one problem we find is that once one goes, a whole load will then want to follow suit. Also you then end up with children missing learning activities - so many ask to go during circle time, and this is reallyd isruptive not just for the teacher but for the other children. And the child going to the toilet misses lesson time - now it may only eem like 5 minutes, but 5 minutes may inlude missing what the focus activity is going to be, or some key piece of learning - meaning the teacher has to repeat. Fin if a ne off for one child - but again, if it becomes 2, 3, 4 children - a real pain.
A 7 year old should, IMO, be able to hold on between lessons. If they go before school starts, at break time, at lunch and then again at afternoon play then they shouldn't really need to be going again during learning time. The maximum amount of time between breaks is only 1.5 hours generally, sometimes less - surely most children at this age don't need to go that often?
If your DD has some medical reason for needing to go frequently then yes - tell the teacher and have her have permission to leave.
We do allow our infant classes to go if they are desperate but it is strongly discouraged and they are all given reminders before play times about going to the toilet.