Masking messes up in after effects after rendering
Once the Rotobrush tool has been selected to use (assuming you used Rotobrush based on the pink outline) a small box in the bottom right of the comp will appear and should say "Freeze." Literally just press that and it'll freeze the mask... fixed my masking render glitch and I hope it does for you too! Best of luck, happy editing.