While mbox and maildir files get deleted by dovecot right away, that's not the case for mdbox files. Since they contain multiple mails at once in a proprietary format rewriting is expensive. That's why this step is done in a separate step outside the dovecot process.