diff --git a/core/lib/Drupal/Core/Theme/ThemeManager.php b/core/lib/Drupal/Core/Theme/ThemeManager.php
index ed18039..556c5a3 100644
--- a/core/lib/Drupal/Core/Theme/ThemeManager.php
+++ b/core/lib/Drupal/Core/Theme/ThemeManager.php
@@ -3,6 +3,7 @@
 namespace Drupal\Core\Theme;
 
 use Drupal\Component\Render\MarkupInterface;
+use Drupal\Core\Render\Element;
 use Drupal\Core\Render\Markup;
 use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\Core\Routing\StackedRouteMatchInterface;
@@ -282,9 +283,17 @@ public function render($hook, array $variables) {
       }
     }
     if (isset($info['preprocess functions'])) {
+      $original_variable_children = array_filter(array_keys($variables), '\Drupal\Core\Render\Element::child');
       foreach ($info['preprocess functions'] as $preprocessor_function) {
         if (function_exists($preprocessor_function)) {
           $preprocessor_function($variables, $hook, $info);
+          if ($preprocessor_function === 'template_preprocess') {
+            $original_variable_children = array_filter(array_keys($variables), '\Drupal\Core\Render\Element::child');
+          }
+          $variable_children = array_filter(array_keys($variables), '\Drupal\Core\Render\Element::child');
+          if ($variable_children !== $original_variable_children && isset($info['variables'])) {
+            throw new \Exception("$preprocessor_function added the following keys: " . implode(', ', array_diff($variable_children, $original_variable_children)));
+          }
         }
       }
       // Allow theme preprocess functions to set $variables['#attached'] and
