Based on cleanupRemovedModules.php. Update both to use safer batching,
based on known selection instead of recursing until the table is empty
(which may end up deleting new rows from live traffic).
Bug: T158105
Change-Id: I05f650a0cfa8ca647f143a40e1087338adbef6da