override MenuLinkTree Block I want to override the block menu behavior, but i don't know how to do that, because the menu block are created dynamically. 

I know add some block with the block plugin, like this :

/** 
 *
 * @Block(
 *   id = "system_name_block",
 *   admin_label = @Translation("my Block"),
 * )
 */


But i don't find how the core deal to create dynamic block for the Menu link tree. 

I ever know that i have to override this class to get the espected behavior :
Drupal/Menu/MenuLinkTree. 

But Now i've to know how to create dynamically some block to use it.
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',
    ));