I'm not familiar with the algorithm behind the validation, but:

- the above check occurs only if the child node type definition has ancestors: https://github.com/ModeShape/modeshape/blob/3.1.x/modeshape-jcr/src/main/java/org/modeshape/jcr/RepositoryNodeTypeManager.java#L2491

- inside the same loop this inner loop https://github.com/ModeShape/modeshape/blob/3.1.x/modeshape-jcr/src/main/java/org/modeshape/jcr/RepositoryNodeTypeManager.java#L2521 doesn't seem to care about any ancestor information anyway

Maybe I'm missing something