system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: What exactly stops our bodies from defecating and urinating as we sleep? What acts as an "alarm" that jolts us awake when we do need to do these things?

Edit: Jesus, this blew up. Instead of replying to everything (of course I'm going to try to get to a lot), I'd just like to say thank you to the massive knowledge drop I've received. I did not expect so much information about how my body is basically an automaton. Super cool!! Thank you guys!
gpt
So your body has these muscles called internal and external sphincters. They act like these rubber bands around your rectum and your urethra (where pee comes out). You can control the external sphincters but can’t control the internal sphincters. The feeling that you need to pee or poop comes from the internal sphincters saying “hey we need to go” to your brain and then they relax/open to let said pee or poop out. The clinching feeling when you’re trying to hold it in is your external sphincters, which you can control. When you’re sleeping/awake these sphincters are constantly contracted/closed but if the internal sphincters relax/open, then your brain will wake you up because you have to go.