I fixed the issue myself.
I changed the thresholds in “compress hierarchy” and “create submenus based on prefixes”.