It's likely that your dog follows you into the bathroom because of their animal instinct and pack mentality. Velcro dogs are referred to as such due to their desire to be attached to you. They may follow you around, even to the bathroom, to protect a part of their pack.
Let's Get It Fixed!
HomeX virtual experts will assess your issue (for free!) and can resolve simple problems.