If no-one is doing it through the UI then somone or some process must be changing it in the database.
If you are setting the edit permission on the module rather than the page I would inspect the AuthorizedEditRoles field in the row corresponding to the moduleid in the mp_Modules table immediately after editing and again after you see the change in the ui. If you are setting it on the page I would look at the row in mp_Pages corresponding to the page id
Hope that helps,
Joe