The patient_id field is added by a sentinel transition. This operation happens on the server, and depending on the sentinel queue, there could be some delay until the field gets populated.
So this is expected. The workaround is to populate the patient_uuid field in the form as well, using the _id field of the patient document. The CHT will fall back to that value to determine the patient if patient_id is empty.