protected function getPluginManagerServices() {
    $container_builder = $this->containerBuilderGetter->getContainerBuilder();

    // Get the definitions of services from the container.
    $definitions = $container_builder->getDefinitions();

    // Filter them down to the ones that are plugin managers.
    $plugin_manager_service_ids = [];
    foreach ($definitions as $service_id => $definition) {
      // Skip any deprecated service.
      if ($definition->isDeprecated()) {
        continue;
      }

      // Assume that any service whose name is of the form plugin.manager.FOO
      // is a plugin type manager.
      if (strpos($service_id, 'plugin.manager.') === 0) {
        $plugin_manager_service_ids[] = $service_id;

        continue;
      }

      // Skip the entity type manager: these don't behave at all like normal
      // plugins.
      if ($service_id == 'entity_type.manager') {
        continue;
      }

      // Find any plugin managers which don't conform to the pattern for the
      // service name, but do inherit from the DefaultPluginManager class.
      $service_class = $definition->getClass();
      if (is_subclass_of($service_class, \Drupal\Core\Plugin\DefaultPluginManager::class)) {
        $plugin_manager_service_ids[] = $service_id;
      }
    }

    // Filter out a blacklist of known broken plugin types.
    $plugin_manager_service_ids = array_diff($plugin_manager_service_ids, [
      // https://www.drupal.org/project/ctools/issues/2938586
      'plugin.manager.ctools.relationship',
    ]);

    //drush_print_r($plugin_manager_service_ids);

    // Developer trapdoor: just process the block plugin type, to make terminal
    // debug output easier to read through.
    //$plugin_manager_service_ids = array('plugin.manager.block');

    return $plugin_manager_service_ids;
  }