diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 7ec8d0f..a7a6456 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -918,10 +918,13 @@ function system_get_info($type, $name = NULL) {
 /**
  * Helper function to scan and collect module .info.yml data.
  *
+ * @param $extension_type
+ *   Either 'module' or 'theme'.
+ *
  * @return \Drupal\Core\Extension\Extension[]
  *   An associative array of module information.
  */
-function _system_rebuild_module_data() {
+function _system_rebuild_module_data($extension_type = 'module') {
   $listing = new ExtensionDiscovery(\Drupal::root());
 
   // Find installation profiles. This needs to happen before performing a
@@ -938,7 +941,7 @@ function _system_rebuild_module_data() {
   }
 
   // Find modules.
-  $modules = $listing->scan('module');
+  $modules = $listing->scan($extension_type);
   // Include the installation profile in modules that are loaded.
   if ($profile) {
     $modules[$profile] = $profiles[$profile];
@@ -975,9 +978,7 @@ function _system_rebuild_module_data() {
 
     // Invoke hook_system_info_alter() to give installed modules a chance to
     // modify the data in the .info.yml files if necessary.
-    // @todo Remove $type argument, obsolete with $module->getType().
-    $type = 'module';
-    \Drupal::moduleHandler()->alter('system_info', $modules[$key]->info, $modules[$key], $type);
+    \Drupal::moduleHandler()->alter('system_info', $modules[$key]->info, $modules[$key], $module->getType());
   }
 
   // It is possible that a module was marked as required by
