Solved the problem temporarily by adapting the 'rolepermissionpermissions' child route as following:
'rolepermission' => array(
'type' => 'segment',
'options' => array(
'route' => '/rolepermission',
'constraints' => array(),
'defaults' => array(
'controller' => 'My\Controller\RolePermission',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'rolepermissionroleid' => array(
'type' => 'segment',
'options' => array(
'route' => '/:roleid',
'constraints' => array(
'roleid' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
'action' => 'detail'
),
),
'may_terminate' => true,
'child_routes' => array(
'rolepermissionpermissionid' => array(
'type' => 'segment',
'options' => array(
'route' => '[/permission/:permissionid]',
'constraints' => array(
'permissionid' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
'action' => 'detail',
),
),
'may_terminate' => true,
'child_routes' => array(
'rolepermissionaction' => array(
'type' => 'segment',
'options' => array(
'route' => '/action/:action',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
'action' => 'detail'
),
),
'may_terminate' => true,
'child_routes' => array(),
),
),
),
),
),
),
),
Although it's indeed not the best solution, this works for now.