If a 10 year old was desperate for a pee 5 minutes after break, then they were certainly aware of the fact during their break and knew what to do. Schools have these rules and kids are frequently reminded of them which is why most kids manage. Where there's a medical condition, obviously allowance are made (so long as parents make the school aware - which they don't always do until after the event).
They wanted to miss some maths!
As was said, the kid was desperate on the way home. This was probably an hour or more later. In the meanwhile, they could've gone in the way out of school before getting into the car. But they didn't, meaning they weren't as desperate as they made out.