Literally same thing happened to me. I was worried for a long time, but other mums had the same stories. My daughter was absolutely fine with herself, no pain or discomfort as far as I could see, just horrible nappies for me to change. I did try lessening the fruit intake and adding more carbohydrates and protein and it did nothing.
I always know my son is teething by runny more frequent poops!
As far as I’m aware there’s no medical evidence to prove teething can cause diarrhoea/loose stools. A month is a long time for this to be happening, maybe consult your doctor x