Most bathrooms are small. And in many homes, the toilet is pretty close to the bathroom sink where you keep your toothbrush.
Every toilet flush sends a spray of bacteria into the air. And you don't want the toilet spray anywhere near your open toothbrush.
You also wouldn't eat after going to the bathroom without first washing your hands. The same advice applies before brushing your teeth.