I looked it up and saw the explanation that when you’re a child, a full bladder doesn’t wake you up so you piss the bed, whereas it does as an adult. This clearly isn’t the full story, however: needing to piss while you’re asleep as a kid often causes you to dream about it, causing you do relieve yourself irl.
As an adult I at least still occasionally get those dreams – but they (thankfully!) don’t result in any actual urine. How does this work?