override MenuLinkTree Block
The menu block is defined in the core module system.

Here you can see how the menu tree is set when creating the object:

core/modules/system/src/Plugin/Block/SystemMenuBlockTest.php:

namespace Drupal\system\Plugin\Block;

use Drupal\Core\Block\BlockBase;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Menu\MenuActiveTrailInterface;
use Drupal\Core\Menu\MenuLinkTreeInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Provides a generic Menu block.
 *
 * @Block(
 *   id = "system_menu_block",
 *   admin_label = @Translation("Menu"),
 *   category = @Translation("Menus"),
 *   deriver = "Drupal\system\Plugin\Derivative\SystemMenuBlock"
 * )
 */
class SystemMenuBlock extends BlockBase implements ContainerFactoryPluginInterface {

  /**
   * The menu link tree service.
   *
   * @var \Drupal\Core\Menu\MenuLinkTreeInterface
   */
  protected $menuTree;
  ...
  public function __construct(array $configuration, $plugin_id, $plugin_definition, MenuLinkTreeInterface $menu_tree, MenuActiveTrailInterface $menu_active_trail) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this-&gt;menuTree = $menu_tree;
    $this-&gt;menuActiveTrail = $menu_active_trail;
  }


How to use your own menu tree in a menu block you can see in this test:

core/modules/system/src/Tests/Block/SystemMenuBlockTest.php


Example from SystemMenuBlockTest.php. A menu that was created before is put in a block config:

$block = Block::create(array(
      'plugin' =&gt; 'system_menu_block:' . $this-&gt;menu-&gt;id(),
      'region' =&gt; 'footer',
      'id' =&gt; 'machinename',
      'theme' =&gt; 'stark',
    ));