Whenever I sit on the toilet, my cats come to me and rest at my feet. Why? Do they miss something?
It is one of the most common behaviour in cats.
Cats normally do not just follow you to the bathroom, they usually follow their human companion to everywhere. But cats following us to the bathroom is more noticeable, hence the confirmation bias.
Cats following humans can be due to a variety of reasons. They might be spooked by something you can't see or hear, they might want food (my cat's favourite reason to follow me to the bathroom), they might want pets, they might be curious or in some rare cases, they might think that you are vulnerable with your pants down so they might want to protect you.
I observed that most cats have a daily routine. They go to sleep at similar hours, demand food or pets at similar hours etc. Your bathroom schedule might have synchronised with your cats' petting schedule so that might be why they are following you.
One more thing, cats also learn from other cats, so one of them might just be following you because the other one is.
I believe, in essence, it has to do with the cats both being curious and wanting to keep us companionship. With that being said, I think an additional and significant factor attracting cats to follow people to the bathroom could also be their common fascination with running water - cats are known to frequently have an obsession with sinks, faucets, drains and porcelain thrones for that reason.
It has to do with their instincts - cats prefer running water over stagnant water, because in nature it is a lot safer to drink; they are thus intrigued and interested by both the sight and the sound of running water. Because the majority of visible and audible water flow occurs whenever there is a person inside the bathroom, they are compelled to follow in.
According to Dr. Kathryn Primm on iheartcats, cats feel vulnerable when you aren't around and they're curious and these are reasons for them to follow you to the toilet.
But I like the take from meowlingtons that cats don't respect your privacy. This coincides with my own experience.
I share a cat with my girlfriend. The cat is less respectful to her than to me as I taught it discipline and don't just give it whatever it wants when it wants it. For example I require the cat to sit and patiently wait for food while the girlfriend lets the cat jump up and practically climb all over her as she's preparing food.
Furthermore I have observed that a cat will not even think about touching food I leave on my plate even when I'm in a different room but it will try to pounce on my girlfriend's food even when she's holding the plate so the cat's behavior is also (not exclusively) linked to respect (or whatever you wish to call it) in my experience.
Anyhow, this cat never comes into the bathroom when I'm on the toilet. Sometimes she will wait outside the doorway. So from my point of view, the cat does what it thinks you want. If it thinks you want to wear cat fur coat 24/7 that's what you get.
The cat may also be curious to learn how to do what you're doing. I had a tortoise calico kitten who was very interested in bathroom routines. By the time she was three, she would sit on the edge of the toilet seat and do her own business. She even figured out the flusher a few years later!
After she learned to use the toilet, she never went back to the litter box again.
Sadly, as she got older, she couldn't balance on the seat and would just sit in the bowl making a matted mess of her back end. Eventually, she moved to using the bathroom sink. Cleaning out the sink was... less pleasant. She never bothered with learning the sink faucet controls. And she never went back to using the litter box to matter how hard I tried.