`hook_module_implements_alter()` is invoked only for those hooks that are invoked via [`ModuleHandler::alter()`][1], [`ModuleHandler::invokeAll()`][2], and [`ModuleHandler::invokeAllWith()`][3]. All those methods call [`ModuleHandler::getImplementationInfo()`][4], which calls [`ModuleHandler::buildImplementationInfo()`][5], which contains the following code. (See the line after the *Verify implementations that were added or modified.* comment.)

```php
  // Allow modules to change the weight of specific implementations, but avoid
  // an infinite loop.
  if ($hook != 'module_implements_alter') {
    // Remember the original implementations, before they are modified with
    // hook_module_implements_alter().
    $implementations_before = $implementations;

    // Verify implementations that were added or modified.
    $this->alter('module_implements', $implementations, $hook);

    // Verify new or modified implementations.
    foreach (array_diff_assoc($implementations, $implementations_before) as $module => $group) {
      // If an implementation of hook_module_implements_alter() changed or
      // added a group, the respective file needs to be included.
      if ($group) {
        $this->loadInclude($module, 'inc', "{$module}.{$group}");
      }

      // If a new implementation was added, verify that the function exists.
      if (!function_exists($module . '_' . $hook)) {
        throw new \RuntimeException("An invalid implementation {$module}_{$hook} was added by hook_module_implements_alter()");
      }
    }
  }
```

The list of the preprocess hooks is gathered from the following code.

```php
if (function_exists($name . '_preprocess_' . $hook)) {
  $cache[$hook]['preprocess functions'][] = $name . '_preprocess_' . $hook;
  $cache[$hook]['theme path'] = $path;
}
```

The code that invokes them does not use the methods from the `ModuleHandler` class I listed earlier, which means `hook_module_implements_alter()` is not invoked for preprocess hooks.













  [1]: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Extension%21ModuleHandler.php/function/ModuleHandler%3A%3Aalter/9
  [2]: https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Extension!ModuleHandler.php/function/ModuleHandler%3A%3AinvokeAll/9
  [3]: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Extension%21ModuleHandler.php/function/ModuleHandler%3A%3AinvokeAllWith/9
  [4]: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Extension%21ModuleHandler.php/function/ModuleHandler%3A%3AgetImplementationInfo/9
  [5]: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Extension%21ModuleHandler.php/function/ModuleHandler%3A%3AbuildImplementationInfo/9