Nope, IMAP can't provide the kind of smooth reliable experience that the Fastmail mobile app provides. Now they obviously could have done it in many different ways, but I know from experience with IMAP that it can't do it.
The amount of times IMAP has resulted in duplicate emails when moving mail between folders for me is enough that I eventually gave up on attempting any kind of organization back when I was last using it.
Anyway, It has been some years since I last used IMAP. I had issues with Outlook, Thunderbird and Nylas N1 while connecting to Gmail, Exchange and Office365. It was a fairly small mailbox getting about 20k mail a year and keeping about half of that. Usually moving about 5k mail around at a time (end of year).
It got so bad that I had to get familiar enough with the IMAP protocol to make my own client program to handle deduplication overnight. Shortly after that I decided to just give up on trying to keep thinks organized.
I am in Australia and this was before the NBN, so obviously it was always on shitty connections.