TMDM-7354: "use studio export content from mdm server ,need reordering the statements"

Fix incorrect order for LENIENT sort.
Fix including twice types in breakable cycles.
Fix including multiple times types when cycle intersection isn't empty.
Add unit test for reproducing issue.
Fix incorrect warning for system data model (when reusable type is first used in a reusable type, then in an entity type).
Merge branch 'master' into prototype/joint_er