how to pass a parameter to a route of type _entity_form
With the help of 4k4 who have all the credit for this answer, I have created a controler which, in turn, build my register form (I no longer need to extend the register form).
Before building the form, the controller must create a user and assign the role (coming from the parameter).

Here is the code

1-Create the route with rid as the parameter and a _controler key:

my_module.register:
  path: '/register/{rid}'
  defaults:
    _controller: '\Drupal\my_module\Controller\RegisterByRoleController::content'
    _title: 'Register by role'
  requirements:
    _permission: 'access content'    


2-Create the controller with rid as the parameter (src/Controller/...):

    public function content($rid=null) {

      $user_with_role = \Drupal\user\Entity\User::create();
      $roles = Role::loadMultiple();
      if ($rid &amp;&amp; isset($roles[$rid])){
          $user_with_role-&gt;addRole($rid);
      }else{
          throw new \Symfony\Component\HttpKernel\Exception\NotFoundHttpException();
      }

      $form = \Drupal::entityTypeManager()
      -&gt;getFormObject('user', 'register')
      -&gt;setEntity($user_with_role);

      $form_build=\Drupal::formBuilder()-&gt;getForm($form);

      //here is the trick I used to check the role
      $form_build['account']['roles'][$rid]['#checked']=TRUE;
      return $form_build;            
  }


Everything works well: the form is displayed, the rid is transmitted to the controller but the is still a problem:

The "transmitted" role's checkbox is not checked in the register form!

Any Hint?

I answer myself: it seems there is no way to achieve this "automatically", I will have to check "myself" the check boxes... see the last comment here: Default value for form entity

This is why is have added this line in the code $form_build['account']['roles'][$rid]['#checked']=TRUE;