回答:
現在のルート名を取得するには、次を使用します。
$route_name = \Drupal::routeMatch()->getRouteName();現在のページのルート名を、テーマの「.theme」ファイルの変数として追加できます。このような_preprocess_page関数を追加し、drupalキャッシュをクリアします。
/**
 * Implements hook_preprocess_page().
 *
 */
function mytheme_preprocess_page(&$variables) {
  $variables['route_name'] = \Drupal::routeMatch()->getRouteName();
}
次に、page.html.twigで次のようにアクセスできます。
{{ route_name }}注: \Drupal::routeMatch()->getRouteName()時々nullを返します。
クラス内にいる場合は、適切に処理するために、コンストラクターにルートマッチサービスを挿入し、次のように呼び出します。
$this->currentRouteMatch->getRouteName()コンストラクター(および変数)は次のようになります。
  /**
   * The current route match.
   *
   * @var \Drupal\Core\Routing\RouteMatchInterface
   */
  protected $currentRouteMatch;
  /**
   * Constructs a new ThemeTestSubscriber.
   *
   * @param \Drupal\Core\Routing\RouteMatchInterface $current_route_match
   */
  public function __construct(RouteMatchInterface $current_route_match) {
    $this->currentRouteMatch = $current_route_match;
  }
サービスクラスの場合は、カスタムモジュールのyamlファイルでサービスに渡します。
services:
  mymodule.service:
    class: Drupal\mymodule\MyCustomService
    arguments: ['@current_route_match']