How are children menu entries detected?

You could try this technique: Menu with unlimited levels