I can’t speak for everyone, but I can speak for myself. I was potty trained before I was allowed in or near a pool. My parents enrolled me in swim lessons. Urine, as opposed to feces, typically has no bacteria in it unless the person has a UTI. Even then chlorine readily kills it. Feces, OTOH has lots of things not good for people. E. coli
For starters, clostridium can be a bigger issue. Cryptosporidium is an even bigger health risk, especially to anyone with a compromised immune system. It nearly killed my wife in 2010.
It is NOT absolutely necessary for non-potty trained children to learn to swim in public pools where it can infringe on everyone else’s rights to use a pool free from worry about fecal contamination. I haven’t looked, but it wouldn’t surprise me if one of the requirements for swim lessons is the child must be potty trained.