Handle threads spanning multiple folders in generic actions

Summary:
This is a diff that fixes T501 and T549. It's only a proof of concept on the generic actions. Here's some of the changes:
- refactor the generic actions to remove `syncback_action`. The whole higher-order stuff was used only because we wanted to retry actions and it didn't mesh well with executing the same action on multiple folders. Also note that the code doesn't care about retrying things on IMAP failures because (in theory) the syncback service handles this for us.
- I made some cleanups to the syncback code and I bundled some fixes to the tests (sorry but this branch originally started as test fixes).

Test Plan: Ran the actions on a fastmail account.

Reviewers: kav-ya, emfree

Reviewed By: emfree

Projects: #sync-engine

Maniphest Tasks: T501

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