I had a similar problem and eventually solved it.
Problem as follows. Three devices: MacBook, iMac, and iPhone. Apple Mail on iMac, and iPhone synced perfectly. Deleting or moving an email on one device would lead to the the same happening on the other devices. This was not so between my MacBook and the other two devices. In fact, I found that the problem was only with one account (my work email account; my home email account, Gmail, was fine). So on my MacBook I would delete or move emails in this account but things would stay unchanged on the iMac, and iPhone.
Solution. The solution was as follows. On the problematic device (MacBook in my case) do the following. (1) Quit Mail. (2.1) In System Prefs > Internet Accounts deselect the offending account (2.2) Open Mail (the account will not be there); (2.3) Quit Mail. (3) Go to Library > Mail > V9 > Mail Data and delete all files starting 'Envelope Index. (The folder might not be V9, it might be something similar, such as V7 or V11 perhaps.) (4) While still in Mail Data look at the folders with long strings of letters and numbers (e.g. AC7D8BA0-D3D5-4289-AF19-C42EC9U4BD94). Look inside these folders and you will see that they have subfolders corresponding to the mailboxes/folders in your email accounts. Use this to identify which of the folders with the long string is the one corresponding to the account with which you are having trouble. Delete that folder. (5) Go back to System Prefs > Internet Accounts and reselect the account. (6) Restart Mail.
You will now have to wait a while for Mail to import all the emails for that account from the server and to index them. That can take a long time, but it was worth it to me to solve the problem. I am not sure whether steps (2) and (5) are necessary. But I do think that step (4) is the key, since deleting this older forces Mail to re-import all the messages from the server, thereby re-establishing the right connections. (If you are cautious you will move rather than delete the files/folders in question.)
I hope this works for you.