Thanks for coming to Developer Community and thanks for your question. In summary, yes you are right. The migration runs in a thread that isn’t attached to the local user.
I did find reference to this before and the posted solution is the best answer