We say in the bracha of Asher Yatzar that גלוי וידוע לפני כסא כבודך, this means that it is Hashem Himself who is involved in everything that takes place in this world down to its finest detail, even this act of relieving oneself. It is therefore understood why we have halachos of tznius also in the bathroom, because the supervision of Hashem is all over.