I don't know whether hernias can cause this type of issue.
My son went through it Around the age of 4, 4.5 years old. He, however, is a tightly-wound, Type-A, anxious type of kid. Prior to the constant bathroom runs, he was actually notorious for peeing just TWICE a day, once upon waking and once nearing bedtime. When the constant peeing started, we of course pursued medical causes because it was such a drastic change from what his bathroom habits had beem. The doctor basically ruled out diabetes and who knows what else, and left us to believe that the obsessive peeing (which it had become, for him, by that point) was the flip side of the urine withholding that he had been doing. And to think, I never even knew he'd been "withholding," per se. Anyway...my son does suffer from anxiety, and he always has. So for us, this made perfect sense. And even as the result of a true anxiety disorder, the crazy peeing did subside, though it took months. Please know that I do not mean to suggest your son has an anxiety disorder or that he is on the verge of acquiring one! Even just an increase in self-awareness can bring on a change like this. Or, another child's peeing "accident." Or anything slight but new in his life. Or...??? Kids can be mysteries sometimes!