Keep menu open for custom content entities
My solution turned out to be the contributed module Menu Trail By Path: because I can fine-tune the actual URLs in all of my entities' YAML files, I can define the hierarchy easily.