This is because PKHeX exhausts all possible encounters and retains the last one it checked, which happens to be an event encounter.
Transferring 3->4 disallows transferring Pokémon with HM moves. In transferring 3->4, it deletes these HM moves and tries to fix the moves. However, since you have two HM moves first, it fails to shift things down.
Behavior used to work >4 years ago, but was broken in this commit: https://github.com/kwsch/PKHeX/commit/75202c7a89a082953ed3771bcf6d32894350cdfd
Now, with the latest commit (and future release), the reorder logic will now loop to account for multiple empty slots: https://github.com/kwsch/PKHeX/commit/ad739f1db71a2e508808e1b2f02cb193e138e6b4