diff --git a/core/lib/Drupal/Core/Layout/LayoutDefault.php b/core/lib/Drupal/Core/Layout/LayoutDefault.php
index 8f2370d..22edb85 100644
--- a/core/lib/Drupal/Core/Layout/LayoutDefault.php
+++ b/core/lib/Drupal/Core/Layout/LayoutDefault.php
@@ -34,7 +34,13 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
    * {@inheritdoc}
    */
   public function build(array $regions) {
-    $build = array_intersect_key($regions, $this->pluginDefinition->getRegions());
+    // Ensure $build only contains defined regions and in the order defined.
+    $build = [];
+    foreach ($this->getPluginDefinition()->getRegionNames() as $region_name) {
+      if (array_key_exists($region_name, $regions)) {
+        $build[$region_name] = $regions[$region_name];
+      }
+    }
     $build['#settings'] = $this->getConfiguration();
     $build['#layout'] = $this->pluginDefinition;
     $build['#theme'] = $this->pluginDefinition->getThemeHook();
diff --git a/core/tests/Drupal/Tests/Core/Layout/LayoutDefaultTest.php b/core/tests/Drupal/Tests/Core/Layout/LayoutDefaultTest.php
new file mode 100644
index 0000000..91aadb7
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Layout/LayoutDefaultTest.php
@@ -0,0 +1,87 @@
+<?php
+
+namespace Drupal\Tests\Core\Layout;
+
+use Drupal\Core\Layout\LayoutDefault;
+use Drupal\Core\Layout\LayoutDefinition;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * @coversDefaultClass \Drupal\Core\Layout\LayoutDefault
+ * @group Layout
+ */
+class LayoutDefaultTest extends UnitTestCase {
+
+  /**
+   * @covers ::build
+   * @dataProvider providerTestBuild
+   */
+  public function testBuild($regions, $expected) {
+    $definition = new LayoutDefinition([
+      'theme_hook' => 'layout',
+      'library' => 'core/drupal',
+      'regions' => [
+        'left' => [
+          'label' => 'Left',
+        ],
+        'right' => [
+          'label' => 'Right',
+        ],
+      ],
+    ]);
+    $expected += [
+      '#settings' => [],
+      '#layout' => $definition,
+      '#theme' => 'layout',
+      '#attached' => [
+        'library' => [
+          'core/drupal',
+        ],
+      ],
+    ];
+
+    $layout = new LayoutDefault([], '', $definition);
+    $this->assertSame($expected, $layout->build($regions));
+  }
+
+  /**
+   * Provides test data for ::testBuild().
+   */
+  public function providerTestBuild() {
+    $data = [];
+    // Empty regions are not added.
+    $data['right_only'] = [
+      [
+        'right' => [
+          'foo' => 'bar',
+        ],
+      ],
+      [
+        'right' => [
+          'foo' => 'bar',
+        ],
+      ],
+    ];
+    // Regions will be in the order defined by the layout.
+    $data['switched_order'] = [
+      [
+        'right' => [
+          'foo' => 'bar',
+        ],
+        'left' => [
+          'foo' => 'baz',
+        ],
+      ],
+      [
+        'left' => [
+          'foo' => 'baz',
+        ],
+        'right' => [
+          'foo' => 'bar',
+        ],
+      ],
+    ];
+    return $data;
+  }
+
+}
