diff --git a/core/modules/views/src/Plugin/Block/ViewsBlock.php b/core/modules/views/src/Plugin/Block/ViewsBlock.php
index 43ff658..ad8d7c9 100644
--- a/core/modules/views/src/Plugin/Block/ViewsBlock.php
+++ b/core/modules/views/src/Plugin/Block/ViewsBlock.php
@@ -27,11 +27,6 @@ public function build() {
     // entry for the view output by passing FALSE, because we're going to cache
     // the whole block instead.
     if ($output = $this->view->buildRenderable($this->displayID, [], FALSE)) {
-      // Override the label to the dynamic title configured in the view.
-      if (empty($this->configuration['views_label']) && $this->view->getTitle()) {
-        $output['#title'] = ['#markup' => $this->view->getTitle(), '#allowed_tags' => Xss::getHtmlTagList()];
-      }
-
       // Before returning the block output, convert it to a renderable array
       // with contextual links.
       $this->addContextualLinks($output);
@@ -41,6 +36,11 @@ public function build() {
       // #pre_render callback has already been applied.
       $output = View::preRenderViewElement($output);
 
+      // Override the label to the dynamic title configured in the view.
+      if (empty($this->configuration['views_label']) && $this->view->getTitle()) {
+        $output['#title'] = ['#markup' => $this->view->getTitle(), '#allowed_tags' => Xss::getHtmlTagList()];
+      }
+
       // When view_build is empty, the actual render array output for this View
       // is going to be empty. In that case, return just #cache, so that the
       // render system knows the reasons (cache contexts & tags) why this Views
diff --git a/core/modules/views/tests/src/Kernel/Plugin/ViewsBlockTest.php b/core/modules/views/tests/src/Kernel/Plugin/ViewsBlockTest.php
index f30db33..d06ae66 100644
--- a/core/modules/views/tests/src/Kernel/Plugin/ViewsBlockTest.php
+++ b/core/modules/views/tests/src/Kernel/Plugin/ViewsBlockTest.php
@@ -5,6 +5,7 @@
 use Drupal\views\Plugin\Block\ViewsBlock;
 use Drupal\views\Tests\ViewTestData;
 use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
+use Drupal\views\Views;
 
 /**
  * Tests native behaviors of the block views plugin.
@@ -51,4 +52,79 @@ public function testMachineNameSuggestion() {
     $this->assertEqual($views_block->getMachineNameSuggestion(), 'views_block__test_view_block_block_1');
   }
 
+  /**
+   * Tests that ViewsBlock::build() produces the right output with title tokens.
+   *
+   * @see \Drupal\views\Plugin\Block::build()
+   */
+  public function testBuildWithTitleToken() {
+    $view = Views::getView('test_view_block');
+    $view->setDisplay();
+
+    $sorts = [
+      'name' => [
+        'id' => 'name',
+        'field' => 'name',
+        'table' => 'views_test_data',
+        'plugin_id' => 'standard',
+        'order' => 'asc',
+      ],
+    ];
+    // Set the title to the 'name' field in the first row and add a sort order
+    // for consistent results on different databases.
+    $view->display_handler->setOption('title', '{{ name }}');
+    $view->display_handler->setOption('sorts', $sorts);
+    $view->save();
+
+    $plugin_definition = [
+      'provider' => 'views',
+    ];
+    $plugin_id = 'views_block:test_view_block-block_1';
+    $views_block = ViewsBlock::create($this->container, [], $plugin_id, $plugin_definition);
+
+    $build = $views_block->build();
+    $this->assertEquals('George', $build['#title']['#markup']);
+  }
+
+  /**
+   * Tests ViewsBlock::build() with a title override.
+   *
+   * @see \Drupal\views\Plugin\Block::build()
+   */
+  public function testBuildWithTitleOverride() {
+    $view = Views::getView('test_view_block');
+    $view->setDisplay();
+
+    // Add a fixed argument that sets a title and save the view.
+    $view->displayHandlers->get('default')->overrideOption('arguments', array(
+      'name' => array(
+        'default_action' => 'default',
+        'title_enable' => TRUE,
+        'title' => 'Overridden title',
+        'default_argument_type' => 'fixed',
+        'default_argument_options' => [
+          'argument' => 'fixed'
+        ],
+        'validate' => array(
+          'type' => 'none',
+          'fail' => 'not found',
+        ),
+        'id' => 'name',
+        'table' => 'views_test_data',
+        'field' => 'name',
+        'plugin_id' => 'string',
+      )
+    ));
+    $view->save();
+
+    $plugin_definition = [
+      'provider' => 'views',
+    ];
+    $plugin_id = 'views_block:test_view_block-block_1';
+    $views_block = ViewsBlock::create($this->container, [], $plugin_id, $plugin_definition);
+
+    $build = $views_block->build();
+    $this->assertEquals('Overridden title', $build['#title']['#markup']);
+  }
+
 }
