Case Execution. Autocomplete doesn't work correctly

Hi! There is a problem with the autocomplete case. In some situations, it fires earlier than intended.
Capture
autocomplete_case.cmmn (4.4 KB)

Works correctly:
Step 1. The case starts: tasks A and B are active
Step 2. Complete “Task A”: created a new active instance of “Task A” (repeats after completion).
Step 3. Complete “Task B”: “Task C” starts and “Task A” closes.

It works incorrectly:
Step 1. The case starts: tasks A and B are active
Step 2. Complete “Task B”: Task A is closed and the autocomplete case is triggered.

CmmnExecution#doInLock(List)
All children are found (sorted by id, ascending) and to them one by one: exit creteria is checked and executed, and then entry creteria.
In the first variant, it first fulfills the entry criteria for “Task C” (it has a smaller identifier)
In the second variant, the first one fulfills the exit criteria for “Task A”. The parent is immediately notified and since there are no active tasks (the entry criteria have not yet reached) the case is closed.

The behavior seems unpredictable. Is this known? And how do you fix it?
P.S. The option to make “Task C” required does not suit me. This is a small part of a large case.