Could it be that your bunny is afraid or wary of the dog? In the wild, rabbits can hold their poop and/or pee if there is a predator nearby. It may be that domestic rabbits have the same instincts. They know that the scent of the poop and pee could alert the predator to their presence.
It’s strange that your rabbit is eating and drinking normally, though. If he has gas pain or other kind of pain, which is indicated by the teeth grinding, it seems like he wouldn’t be eating or be so eager to eat. If he continues to grind his teeth or you start observing other behavior that isn’t normal, you should try to get him into a vet’s office. If the problem appeared to be gas, you could give him some infant simethicone and see if that helps. Some indications of gas are pushing their stomachs into the floor, or twisting and turning, trying to get comfortable. Have you checked to make sure that he hasn’t injured himself somehow, and that could be the source of pain? You could feel over his body and see if any place seems to be tender. I hope that he will be okay soon.