diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module
index ccf1f9c..8c8d924 100644
--- a/core/modules/toolbar/toolbar.module
+++ b/core/modules/toolbar/toolbar.module
@@ -349,3 +349,13 @@ function _toolbar_get_subtrees_hash() {
   $hash = Crypt::hashBase64(serialize($subtrees));
   return [$hash, $cacheability];
 }
+
+/**
+ * Implements hook_modules_installed().
+ */
+function toolbar_modules_installed($modules) {
+  // Ensures that the router has been rebuilt after a module has been installed
+  // to avoid a Fatal error while trying to show a link to the module's
+  // configuration route defined in its info file.
+  \Drupal::service('router.builder')->rebuildIfNeeded();
+}
