Is there any way to stop OneSync from migrating entites?

which isn’t the right way to solve that issue.

make your script migration-aware instead of trying to stop migration.

basically, send affected network IDs to all clients and use GET_SCRIPT_TASK_STATUS to know if a task vanished.

you should NEVER have to disable migration or manually request control, any cases where you do so are literally bad design.