How to Inject entity object in EntityForm
Declare the entity form in the route via _entity_form instead of _form:

First add a form handler to the entity type:

mymodule.module

/**
 * Implements hook_entity_type_build().
 */
function mymodule_entity_type_build(array &amp;$entity_types) {
  $entity_types['menu']
    -&gt;setFormClass('poweredit', 'Drupal\mymodule\MyMenuForm');
}


Then add the form handler to the route:

mymodule.routing.yml

entity.menu.power_edit_form:
  path: '/admin/structure/menu/manage/power_edit/{menu}'
  defaults:
    _entity_form: 'menu.poweredit'
    _title_callback: '\Drupal\menu_ui\Controller\MenuController::menuTitle'
  requirements:
    _entity_access: 'menu.update'


Now Drupal upcasts the route parameter to an entity and adds it to the form object when it is instantiated.

This is similar to content entities, only that config entities have no form modes. See How to utilize custom form modes to edit a user entity?