Implement asynchronous message/thread deletion in IMAP sync.

Summary:
This prevents e.g. message objects from being deleted and recreated if the
message is moved between folders on the IMAP backend, or if a draft update
causes an old UID to be deleted and a new one to be created.

Fixes T477.

Test Plan: Unit tests added.

Reviewers: spang, kav-ya

Reviewed By: kav-ya

Maniphest Tasks: T477

Differential Revision: https://review.inboxapp.com/D933