How to set paths where to load administration theme?
You need a route subscriber, where you search for routes, which have a path you want to load with the admin theme, and add the option:

$route-&gt;setOption('_admin_route', TRUE);


More info Altering existing routes and adding new routes based on dynamic ones.

Example

There is an example in core. You can configure the admin theme for the node edit form in UI and this route subscriber is applying this configuration:

namespace Drupal\node\EventSubscriber;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;

/**
 * Sets the _admin_route for specific node-related routes.
 */
class NodeAdminRouteSubscriber extends RouteSubscriberBase {

  /**
   * The config factory.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $configFactory;

  /**
   * Constructs a new NodeAdminRouteSubscriber.
   *
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The config factory.
   */
  public function __construct(ConfigFactoryInterface $config_factory) {
    $this-&gt;configFactory = $config_factory;
  }

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {
    if ($this-&gt;configFactory-&gt;get('node.settings')-&gt;get('use_admin_theme')) {
      foreach ($collection-&gt;all() as $route) {
        if ($route-&gt;hasOption('_node_operation_route')) {
          $route-&gt;setOption('_admin_route', TRUE);
        }
      }
    }
  }

}