Macro autoremoved on edit

We have a very simple macro for displaying a pages classification. Since we have several thousand pages that were missing this macro (new requirement) I created a simple script that added the macro to all pages using the API. All pages shows the macro as expected, but when opening a page for editing some pages gets an automatic edit prepended that removes the macro. No clues in any logs (server side or client side).
Does anyone have any insight into what might be going on or how to track this down?