diff --git a/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php b/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php
index 63bd799b345477905c16b2e87ec41ab0e0ac86f3..d7c3a84c75638dc1431f36d51e63a700c8a658eb 100644
--- a/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php
+++ b/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php
@@ -221,7 +221,8 @@ public function form(array $form, FormStateInterface $form_state) {
     $form = parent::form($form, $form_state);
 
     $default = $this->entity->getMenuName() . ':' . $this->entity->getParentId();
-    $form['menu_parent'] = $this->menuParentSelector->parentSelectElement($default, $this->entity->getPluginId());
+    $id = $this->entity->isNew() ? '' : $this->entity->getPluginId();
+    $form['menu_parent'] = $this->menuParentSelector->parentSelectElement($default, $id);
     $form['menu_parent']['#weight'] = 10;
     $form['menu_parent']['#title'] = $this->t('Parent link');
     $form['menu_parent']['#description'] = $this->t('The maximum depth for a link and all its children is fixed. Some menu links may not be available as parents if selecting them would exceed this limit.');
diff --git a/core/modules/menu_ui/src/Tests/MenuTest.php b/core/modules/menu_ui/src/Tests/MenuTest.php
index fbcad7846d32d23c6e3b27bdffffc88d79a88edb..8d574f43b73d20736c107c0974e0ce5b99b3f8ac 100644
--- a/core/modules/menu_ui/src/Tests/MenuTest.php
+++ b/core/modules/menu_ui/src/Tests/MenuTest.php
@@ -462,6 +462,9 @@ function doMenuTests() {
     $this->clickLink($item8->getTitle());
     $this->assertResponse(200);
 
+    // Check invalid menu link parents.
+    $this->checkInvalidParentMenuLinks();
+
     // Save menu links for later tests.
     $this->items[] = $item1;
     $this->items[] = $item2;
@@ -647,6 +650,48 @@ function addInvalidMenuLink() {
     }
   }
 
+  /**
+   * Tests that parent options are limited by depth when adding menu links.
+   */
+  function checkInvalidParentMenuLinks() {
+    $last_link = null;
+    $created_links = array();
+
+    // Get the max depth of the tree.
+    $menu_link_tree = \Drupal::service('menu.link_tree');
+    $max_depth = $menu_link_tree->maxDepth();
+
+    // Create a maximum number of menu links, each a child of the previous.
+    for ($i = 0; $i <= $max_depth - 1; $i++) {
+      $parent = $last_link ? 'tools:' . $last_link->getPluginId() : 'tools:';
+      $title = 'title' . $i;
+      $edit = array(
+        'link[0][uri]' => '<front>',
+        'title[0][value]' => $title,
+        'menu_parent' => $parent,
+        'description[0][value]' => '',
+        'enabled[value]' => 1,
+        'expanded[value]' => FALSE,
+        'weight[0][value]' => '0',
+      );
+      $this->drupalPostForm("admin/structure/menu/manage/{$this->menu->id()}/add", $edit, t('Save'));
+      $menu_links = entity_load_multiple_by_properties('menu_link_content', array('title' => $title));
+      $last_link = reset($menu_links);
+      $created_links[]  = 'tools:' . $last_link->getPluginId();
+    }
+
+    // The last link cannot be a parent in the new menu link form.
+    $this->drupalGet('admin/structure/menu/manage/admin/add');
+    $value = 'tools:' . $last_link->getPluginId();
+    $this->assertNoOption('edit-menu-parent', $value, 'The invalid option is not there.');
+
+    // All but the last link can be parents in the new menu link form.
+    array_pop($created_links);
+    foreach ($created_links as $key => $link) {
+      $this->assertOption('edit-menu-parent', $link, 'The valid option number ' . ($key + 1) . ' is there.');
+    }
+  }
+
   /**
    * Verifies a menu link using the UI.
    *