Steps 4 and 5 have to be performed in the reverse order. Namely, the (foreign key) constraints depend on the primary key created in the indexes file. This was probably introduced in the new DDL generator change.
Not sure whether this is also the case for other SQL languages.