Where do extra parameters come from? Not a real issue but more of an informative question.

Concrete case:

system.routing.yml integrates system.entity_autocomplete that uses controller::method

\Drupal\system\Controller\EntityAutocompleteController::handleAutocomplete. First parameter in handleAutocomplete() is $request and the rest are the ones we could explect from url.

Where did $request come from?
This is a feature provided by Symfony:


  The Request object as a Controller Argument
  
  What if you need to read query parameters, grab a request header or get access to an uploaded file? All of that information is stored in Symfony's Request object. To get it in your controller, just add it as an argument and type-hint it with the Request class:

use Symfony\Component\HttpFoundation\Request;

public function indexAction(Request $request, $firstName, $lastName)
{
  $page = $request-&gt;query-&gt;get('page', 1);

  // ...
}