Well, I do know classes where teachers might -- only for the most serious offenses -- withhold recess as a form of discipline, and it's effective because recess is highly, highly desirable. But this is among older elementary kids, not first graders.
And it would never be used as punishment for needing to use the toilet during class time. Ever. The teacher here is assuming she knows best about another person's bodily functions. A child could have a UTI and need to urinate more often; certainly more kids will GET infections if they feel they must hold their urine when they really need to go.
You said you previously spoke to the teacher "about how we disagree about this rule." Is this solely HER rule, for her own classroom, or do other teachers or even the entire staff do this? If it's only her: I'd try one more talk with her and say you are concerned about UTIs. (If your concern is general, frankly, it will have less weight with her than if your own child actually has specific issues and needs to pee when he or she needs to pee.) If she is still unreceptive, I would then go over her head and talk with maybe the counselor and school nurse at the same time - and if they seem not to want to be involved, then it's principal time.Dashing straight to the principal for this isn't necessarily the way to go, but I'd use the principal as a last resort if you feel very strongly about it.
If this is a policy used by other teachers -- the entire school needs a serious reality check and should stop doing this. Not losing recess -- I think that that can actually be effective as discipline. But the school (if it's an all-school policy) should absolutely not discipline a child for going to the toilet unless the teacher has very convincing reason to believe the child is just messing around and getting out of class.