[FIX] models: in _create() and _write(), mark fields to recompute earlier

An issue occurs when a constraint is checked before computed fields are marked
for recomputation: the constraint will read the field's current value, which
may be wrong.  If the field is marked soon enough, the constraint will trigger
the recomputation and use a correct value.