Masturbation alone should not affect your bowel movements. I would talk to the doctor about this. I would guess it is coincidental. Let us know what the doctor says.
No, it would be two separate things. Talk to your doctor about the diarrhea without worry that he or she will think you are masturbating. It does not cause diarrhea.