Drupal 8 - "Implement menu links as plugins", trying to build a menu tree
You may need to render it as below:

  // Build the main menu links tree.
  if (!empty($vars['main_menu'])) {
    // Build links.
    $config = Drupal::config('menu_ui.settings');
    $menu_enabled = Drupal::moduleHandler()-&gt;moduleExists('menu_ui');
    // When menu module is not enabled, we need hardcoded default values.
    $main_links_source = $menu_enabled ? $config-&gt;get('main_links') : 'main';
    // Allowed max depth.
    // @see MenuTreeStorage::MAX_DEPTH
    $level = 9;
    $menu_tree = \Drupal::menuTree();
    $parameters = $menu_tree-&gt;getCurrentRouteMenuTreeParameters($main_links_source);
    $parameters-&gt;setMaxDepth($level);
    $tree = $menu_tree-&gt;load($main_links_source, $parameters);
    $manipulators = array(
      array('callable' =&gt; 'menu.default_tree_manipulators:checkAccess'),
      array('callable' =&gt; 'menu.default_tree_manipulators:generateIndexAndSort'),
    );
    $tree = $menu_tree-&gt;transform($tree, $manipulators);
    $vars['main_menu'] = $menu_tree-&gt;build($tree);
    $vars['main_menu']['#attributes']['id'] = 'main-menu-links';
    $vars['main_menu']['#attributes']['class'] = array('links', 'clearfix');
    $vars['main_menu']['#theme_wrappers'] = array('menu_tree__primary');
  }


P.S: Make sure you clear cache after update, as it looks like the cache-tag is aggressive and doesn't show same menu in all page at the first run.