Dock unread count is inaccurate
I think I might have found a solution.
I added the following condition to the smart mailbox that the unread count is linked to:

Message is unread

Before I made this change, I noticed a significant lag between marking/unmarking read messages and the unread count on the smart mailbox and the dock badge changing. When I added this condition, the changes were immediate.
I suspect part of the problem may be that some of my folders (including one of my inboxes) have hundreds or thousands of read messages.