diff --git a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php
index 8bfb3a3..7097b85 100644
--- a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php
+++ b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php
@@ -9,6 +9,7 @@
 use Drupal\Core\Field\FieldItemListInterface;
 use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Core\Render\Element;
+use Drupal\Core\Theme\Registry;
 use Drupal\Core\TypedData\TranslatableInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
@@ -55,6 +56,13 @@ class EntityViewBuilder extends EntityHandlerBase implements EntityHandlerInterf
   protected $languageManager;
 
   /**
+   * The theme registry.
+   *
+   * @var \Drupal\Core\Theme\Registry
+   */
+  protected $themeRegistry;
+
+  /**
    * The EntityViewDisplay objects created for individual field rendering.
    *
    * @see \Drupal\Core\Entity\EntityViewBuilder::getSingleFieldDisplay()
@@ -72,12 +80,15 @@ class EntityViewBuilder extends EntityHandlerBase implements EntityHandlerInterf
    *   The entity manager service.
    * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
    *   The language manager.
+   * @param \Drupal\Core\Theme\Registry $theme_registry
+   *   The theme registry.
    */
-  public function __construct(EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager) {
+  public function __construct(EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager, Registry $theme_registry = NULL) {
     $this->entityTypeId = $entity_type->id();
     $this->entityType = $entity_type;
     $this->entityManager = $entity_manager;
     $this->languageManager = $language_manager;
+    $this->themeRegistry = $theme_registry ?: \Drupal::service('theme.registry');
   }
 
   /**
@@ -87,7 +98,8 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
     return new static(
       $entity_type,
       $container->get('entity.manager'),
-      $container->get('language_manager')
+      $container->get('language_manager'),
+      $container->get('theme.registry')
     );
   }
 
@@ -148,7 +160,6 @@ protected function getBuildDefaults(EntityInterface $entity, $view_mode) {
     $this->moduleHandler()->alter('entity_view_mode', $view_mode, $entity, $context);
 
     $build = array(
-      '#theme' => $this->entityTypeId,
       "#{$this->entityTypeId}" => $entity,
       '#view_mode' => $view_mode,
       // Collect cache defaults for this entity.
@@ -159,6 +170,11 @@ protected function getBuildDefaults(EntityInterface $entity, $view_mode) {
       ),
     );
 
+    // Add the default #theme key if a template exists for it.
+    if ($this->themeRegistry->getRuntime()->has($this->entityTypeId)) {
+      $build['#theme'] = $this->entityTypeId;
+    }
+
     // Cache the rendered output if permitted by the view mode and global entity
     // type configuration.
     if ($this->isViewModeCacheable($view_mode) && !$entity->isNew() && $entity->isDefaultRevision() && $this->entityType->isRenderCacheable()) {
diff --git a/core/modules/shortcut/tests/src/Kernel/ShortcutEntityTest.php b/core/modules/shortcut/tests/src/Kernel/ShortcutEntityTest.php
new file mode 100644
index 0000000..ea6f697
--- /dev/null
+++ b/core/modules/shortcut/tests/src/Kernel/ShortcutEntityTest.php
@@ -0,0 +1,20 @@
+<?php
+
+namespace Drupal\Tests\shortcut\Kernel;
+
+use Drupal\KernelTests\KernelTestBase;
+use Drupal\shortcut\Entity\Shortcut;
+
+/**
+ * Tests shortcut entity.
+ *
+ * @group shortcut
+ */
+class ShortcutEntityTest extends KernelTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['system', 'shortcut', 'link'];
+
+}
diff --git a/core/modules/system/tests/modules/entity_test/src/EntityTestViewBuilder.php b/core/modules/system/tests/modules/entity_test/src/EntityTestViewBuilder.php
index 90eaf30..720e3c3 100644
--- a/core/modules/system/tests/modules/entity_test/src/EntityTestViewBuilder.php
+++ b/core/modules/system/tests/modules/entity_test/src/EntityTestViewBuilder.php
@@ -2,7 +2,6 @@
 
 namespace Drupal\entity_test;
 
-use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityViewBuilder;
 
 /**
@@ -15,15 +14,6 @@ class EntityTestViewBuilder extends EntityViewBuilder {
   /**
    * {@inheritdoc}
    */
-  protected function getBuildDefaults(EntityInterface $entity, $view_mode) {
-    $build = parent::getBuildDefaults($entity, $view_mode);
-    unset($build['#theme']);
-    return $build;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   public function buildComponents(array &$build, array $entities, array $displays, $view_mode) {
     parent::buildComponents($build, $entities, $displays, $view_mode);
 
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php
index 156b799..9e1414b 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php
@@ -2,9 +2,11 @@
 
 namespace Drupal\KernelTests\Core\Entity;
 
+use Drupal\Core\Entity\EntityViewBuilder;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
 use Drupal\Core\Cache\Cache;
+use Drupal\shortcut\Entity\Shortcut;
 use Drupal\user\Entity\Role;
 use Drupal\user\RoleInterface;
 
@@ -210,4 +212,23 @@ protected function createTestEntity($entity_type) {
     return $this->container->get('entity.manager')->getStorage($entity_type)->create($data);
   }
 
+  /**
+   * Tests that viewing an entity without template does not specify #theme.
+   */
+  public function testNoTemplate() {
+    // Ensure that an entity type without explicit view builder uses the
+    // default.
+    $entity_type_manager = \Drupal::entityTypeManager();
+    $entity_type = $entity_type_manager->getDefinition('entity_test_base_field_display');
+    $this->assertTrue($entity_type->hasViewBuilderClass());
+    $this->assertEquals(EntityViewBuilder::class, $entity_type->getViewBuilderClass());
+
+    // Ensure that an entity without matching template does not have a #theme
+    // key.
+    $entity = $this->createTestEntity('entity_test');
+    $build = $entity_type_manager->getViewBuilder('entity_test')->view($entity);
+    $this->assertEquals($entity, $build['#entity_test']);
+    $this->assertFalse(array_key_exists('#theme', $build));
+  }
+
 }
