There aren't enough bugs already reported and unfixed? My God, just try using Mail on the iPad for 5 minutes.
The "unread emails" badge has been incorrect every single time for like 6 years now.
Sometimes it just sits and spins until I give up and go do other things. Come back an hour later, it might work fine, it might still fail.
IMAP isn't difficult in 2019.