The simplest method is to write a custom EventSubscriber which removes the header $response->headers->remove('X-Generator'); like in this example https://drupal.stackexchange.com/a/201297/47547 where you need to replace this line only.