macOS Mail app stuck “moving messages”

It sounds like your Apple Mail database is damaged. I suggest doing a complete rebuild, rather than just rebuilding the inbox.