If you took oral magnesium supplements as reccomended on Keto, that’s most likely what caused the extended bathroom experience. I can relate. I went off keto for a time so I could consume a variety of yellow veggies which I craved, but I continued the magnesium supplements. Guess what? Problem still existed. When I stopped the magnesium, my powels protested with severe pain...they had become dependant upon the magnesium...which is often used as a bowel stimulant. Had to gradually reduce it. Magnesium can be absorbed through the skin (epsom salts) without the associated bowel issues. Epsomsalts make a good foot soak or soothing bath.
Hope that helps in case you decide to go back on keto before you regain your weight.
No, I have never been on keto and no plans to and glucophage is notorious for causing lower GI disorder.