I think it might actually be caused by the cleaning. I don't know how, but they just seem to do that to us. Maybe all the movement just makes 'em gotta go?
One time I had just cleaned out all my tubs and tanks before I was going away for a long weekend when I take one last walk by my male kingsnake before walking out the door just to observe him against the side of the tub literally defecating in my general direction on the plastic.
grrrr