diff --git a/core/config/schema/core.data_types.schema.yml b/core/config/schema/core.data_types.schema.yml
index 79e3f14..c725792 100644
--- a/core/config/schema/core.data_types.schema.yml
+++ b/core/config/schema/core.data_types.schema.yml
@@ -777,6 +777,9 @@ entity_reference_selection:
     auto_create:
       type: boolean
       label: 'Create referenced entities if they don''t already exist'
+    auto_create_bundle:
+      type: string
+      label: 'Bundle assigned to the auto-created entities.'
 
 entity_reference_selection.*:
   type: entity_reference_selection
diff --git a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php
index cb8c7d6..f22c914 100644
--- a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php
+++ b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php
@@ -116,6 +116,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
         'field' => '_none',
       ),
       'auto_create' => FALSE,
+      'auto_create_bundle' => NULL,
     );
 
     if ($entity_type->hasKey('bundle')) {
@@ -128,11 +129,23 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
         '#type' => 'checkboxes',
         '#title' => $this->t('Bundles'),
         '#options' => $bundle_options,
-        '#default_value' => (!empty($selection_handler_settings['target_bundles'])) ? $selection_handler_settings['target_bundles'] : array(),
+        '#default_value' => $selection_handler_settings['target_bundles'],
         '#required' => TRUE,
         '#size' => 6,
         '#multiple' => TRUE,
         '#element_validate' => array('_entity_reference_element_validate_filter'),
+        '#ajax' => TRUE,
+        '#limit_validation_errors' => array(),
+      );
+
+      $form['target_bundles_update'] = array(
+        '#type' => 'submit',
+        '#value' => $this->t('Update bundles'),
+        '#limit_validation_errors' => array(),
+        '#attributes' => array(
+          'class' => array('js-hide'),
+        ),
+        '#submit' => array('entity_reference_settings_ajax_submit'),
       );
     }
     else {
@@ -201,13 +214,39 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
       }
     }
 
+    $form['auto_create'] = array(
+      '#type' => 'checkbox',
+      '#title' => $this->t("Create referenced entities if they don't already exist"),
+      '#default_value' => $selection_handler_settings['auto_create'],
+    );
+
+    if ($entity_type->hasKey('bundle')) {
+      $bundles = array_intersect_key($bundle_options, array_filter($selection_handler_settings['target_bundles']));
+      $form['auto_create_bundle'] = array(
+        '#type' => 'select',
+        '#title' => $this->t('Store new items in'),
+        '#options' => $bundles,
+        '#default_value' => $selection_handler_settings['auto_create_bundle'],
+        '#access' => count($bundles) > 1,
+        '#states' => array(
+          'visible' => array(
+            ':input[name="settings[handler_settings][auto_create]"]' => array('checked' => TRUE),
+          ),
+        ),
+      );
+    }
+
     return $form;
   }
 
   /**
    * {@inheritdoc}
    */
-  public function validateConfigurationForm(array &$form, FormStateInterface $form_state) { }
+  public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
+    // Don't store the 'target_bundles_update' button value into the field
+    // config settings.
+    $form_state->unsetValue(['settings', 'handler_settings', 'target_bundles_update']);
+  }
 
   /**
    * {@inheritdoc}
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EntityReferenceAutocompleteWidget.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EntityReferenceAutocompleteWidget.php
index 948079e..d592062 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EntityReferenceAutocompleteWidget.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EntityReferenceAutocompleteWidget.php
@@ -144,21 +144,27 @@ public function massageFormValues(array $values, array $form, FormStateInterface
    *
    * @return string
    *   The bundle name.
+   *
+   * @throws \InvalidArgumentException
+   *   Thrown when the field allows references from multiple target bundles,
+   *   'auto_create' is enabled and 'auto_create_bundle' is not set.
    */
   protected function getAutocreateBundle() {
     $bundle = NULL;
-    if ($this->getSelectionHandlerSetting('auto_create')) {
-      // If the 'target_bundles' setting is restricted to a single choice, we
-      // can use that.
-      if (($target_bundles = $this->getSelectionHandlerSetting('target_bundles')) && count($target_bundles) == 1) {
+    if ($this->getSelectionHandlerSetting('auto_create') && $target_bundles = $this->getSelectionHandlerSetting('target_bundles')) {
+      // If there's only one target bundle, use it.
+      if (count($target_bundles) == 1) {
         $bundle = reset($target_bundles);
       }
-      // Otherwise use the first bundle as a fallback.
-      else {
-        // @todo Expose a proper UI for choosing the bundle for autocreated
-        // entities in https://www.drupal.org/node/2412569.
-        $bundles = entity_get_bundles($this->getFieldSetting('target_type'));
-        $bundle = key($bundles);
+      // Otherwise use the target bundle stored in selection handler settings.
+      elseif (!$bundle = $this->getSelectionHandlerSetting('auto_create_bundle')) {
+        // If no bundle has been set as auto create target means that there is
+        // an inconsistency in entity reference field settings.
+        throw new \InvalidArgumentException(sprintf(
+          "Create referenced entities if they don't already exist option is enabled but a specific destination bundle is not set. You should re-visit and fix the settings of the '%s' (%s) field.",
+          $this->fieldDefinition->getLabel(),
+          $this->fieldDefinition->getName()
+        ));
       }
     }
 
diff --git a/core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php b/core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php
index be11617..0a5ead8 100644
--- a/core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php
+++ b/core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php
@@ -11,6 +11,7 @@
 use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem;
 use Drupal\Core\Field\PreconfiguredFieldUiOptionsInterface;
+use Drupal\Core\Field\FieldDefinitionInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Form\OptGroup;
 use Drupal\Core\Session\AccountInterface;
@@ -230,4 +231,70 @@ public static function getPreconfiguredOptions() {
     return $options;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public static function calculateDependencies(FieldDefinitionInterface $field_definition) {
+    $dependencies = parent::calculateDependencies($field_definition);
+
+    $handler_settings = $field_definition->getSetting('handler_settings');
+    // Dependencies for 'target_bundles' covers also the 'auto_create_bundle'
+    // value, if any, because the latter is included in 'target_bundles' list.
+    if (!empty($handler_settings['target_bundles'])) {
+      $target_type = \Drupal::entityManager()->getDefinition($field_definition->getFieldStorageDefinition()->getSetting('target_type'));
+      if ($bundle_entity_type = $target_type->getBundleEntityType()) {
+        $storage = \Drupal::entityManager()->getStorage($bundle_entity_type);
+        foreach ($handler_settings['target_bundles'] as $id) {
+          if ($bundle = $storage->load($id)) {
+            $dependencies[$bundle->getConfigDependencyKey()][] = $bundle->getConfigDependencyName();
+          }
+        }
+      }
+    }
+
+    return $dependencies;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function onDependencyRemoval(FieldDefinitionInterface $field_definition, array $dependencies) {
+    $changed = parent::onDependencyRemoval($field_definition, $dependencies);
+
+    $handler_settings = $field_definition->getSetting('handler_settings');
+    // Dependencies for 'target_bundles' covers also the 'auto_create_bundle'
+    // value, if any, because the latter is included in 'target_bundles' list.
+    if (!empty($handler_settings['target_bundles'])) {
+      $target_type = \Drupal::entityManager()->getDefinition($field_definition->getFieldStorageDefinition()->getSetting('target_type'));
+      if ($bundle_entity_type = $target_type->getBundleEntityType()) {
+        $storage = \Drupal::entityManager()->getStorage($bundle_entity_type);
+        $auto_create_bundle = !empty($handler_settings['auto_create_bundle']) ? $handler_settings['auto_create_bundle'] : FALSE;
+        foreach ($handler_settings['target_bundles'] as $id) {
+          $bundle = $storage->load($id);
+          if ($bundle && !empty($dependencies[$bundle->getConfigDependencyKey()][$bundle->getConfigDependencyName()])) {
+            // Remove this bundle from target bundles.
+            unset($handler_settings['target_bundles'][$id]);
+            // If this bundle is set also as 'auto_create_bundle' make it NULL.
+            if ($auto_create_bundle && $auto_create_bundle == $id) {
+              $handler_settings['auto_create_bundle'] = NULL;
+            }
+            $changed = TRUE;
+          }
+        }
+
+        // If only one target bundle has left, set that as 'auto_create_bundle'.
+        if (!empty($handler_settings['auto_create']) && count($handler_settings['target_bundles']) === 1) {
+          $handler_settings['auto_create_bundle'] = key($handler_settings['target_bundles']);
+        }
+
+        // If there's no 'auto_create_bundle' set, there's no auto creation.
+        $handler_settings['auto_create'] = !empty($handler_settings['auto_create_bundle']);
+
+        $field_definition->setSetting('handler_settings', $handler_settings);
+      }
+    }
+
+    return $changed;
+  }
+
 }
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php
index 0956896..ec7382a 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php
@@ -7,6 +7,8 @@
 
 namespace Drupal\entity_reference\Tests;
 
+use Drupal\Component\Utility\Unicode;
+use Drupal\field\Entity\FieldConfig;
 use Drupal\Core\Entity\Entity;
 use Drupal\field_ui\Tests\FieldUiTestTrait;
 use Drupal\node\Entity\Node;
@@ -307,13 +309,13 @@ public function testAvailableFormatters() {
     Vocabulary::create(array('vid' => 'tags', 'name' => 'tags'))->save();
 
     // Create entity reference field with taxonomy term as a target.
-    $taxonomy_term_field_name = $this->createEntityReferenceField('taxonomy_term', 'tags');
+    $taxonomy_term_field_name = $this->createEntityReferenceField('taxonomy_term', ['tags']);
 
     // Create entity reference field with user as a target.
     $user_field_name = $this->createEntityReferenceField('user');
 
     // Create entity reference field with node as a target.
-    $node_field_name = $this->createEntityReferenceField('node', $this->type);
+    $node_field_name = $this->createEntityReferenceField('node', [$this->type]);
 
     // Create entity reference field with date format as a target.
     $date_format_field_name = $this->createEntityReferenceField('date_format');
@@ -362,17 +364,78 @@ public function testAvailableFormatters() {
   }
 
   /**
+   * Tests field settings for an entity reference field when the field has
+   * multiple target bundles and is set to auto-create the target entity.
+   */
+  public function testMultipleTargetBundles() {
+    /** @var \Drupal\taxonomy\Entity\Vocabulary[] $vocabularies */
+    $vocabularies = [];
+    for ($i = 0; $i < 2; $i++) {
+      $vid = Unicode::strtolower($this->randomMachineName());
+      $vocabularies[$i] = Vocabulary::create([
+        'name' => $this->randomString(),
+        'vid' => $vid,
+      ]);
+      $vocabularies[$i]->save();
+    }
+
+    // Create a new field pointing to the first vocabulary.
+    $field_name = $this->createEntityReferenceField('taxonomy_term', [$vocabularies[0]->id()]);
+    $field_name = "field_$field_name";
+    $field_id = 'node.' . $this->type . '.' . $field_name;
+    $path = 'admin/structure/types/manage/' . $this->type . '/fields/' . $field_id;
+
+    $this->drupalGet($path);
+
+    // Expect that there's no 'auto_create_bundle' selected.
+    $this->assertNoFieldByName('settings[handler_settings][auto_create_bundle]');
+
+    $edit = [
+      'settings[handler_settings][target_bundles][' . $vocabularies[1]->id() . ']' => TRUE,
+    ];
+    // Enable the second vocabulary as a target bundle.
+    $this->drupalPostAjaxForm($path, $edit, key($edit));
+    // Expect a select element with the two vocabularies as options.
+    $this->assertFieldByXPath("//select[@name='settings[handler_settings][auto_create_bundle]']/option[@value='" . $vocabularies[0]->id() . "']");
+    $this->assertFieldByXPath("//select[@name='settings[handler_settings][auto_create_bundle]']/option[@value='" . $vocabularies[1]->id() . "']");
+
+    $edit = [
+      'settings[handler_settings][auto_create]' => TRUE,
+      'settings[handler_settings][auto_create_bundle]' => $vocabularies[1]->id(),
+    ];
+    $this->drupalPostForm(NULL, $edit, t('Save settings'));
+
+    /** @var \Drupal\field\Entity\FieldConfig $field_config */
+    $field_config = FieldConfig::load($field_id);
+    // Expect that the target bundle has been saved in the backend.
+    $this->assertEqual($field_config->getSetting('handler_settings')['auto_create_bundle'], $vocabularies[1]->id());
+
+    // Delete the other bundle. Field config should not be affected.
+    $vocabularies[0]->delete();
+    $field_config = FieldConfig::load($field_id);
+    $this->assertTrue($field_config->getSetting('handler_settings')['auto_create']);
+    $this->assertIdentical($field_config->getSetting('handler_settings')['auto_create_bundle'], $vocabularies[1]->id());
+
+    // Delete the bundle set for entity auto-creation. Auto-created settings
+    // should be reset (no auto-creation).
+    $vocabularies[1]->delete();
+    $field_config = FieldConfig::load($field_id);
+    $this->assertFalse($field_config->getSetting('handler_settings')['auto_create']);
+    $this->assertFalse(isset($field_config->getSetting('handler_settings')['auto_create_bundle']));
+  }
+
+  /**
    * Creates a new Entity Reference fields with a given target type.
    *
-   * @param $target_type
+   * @param string $target_type
    *   The name of the target type
-   * @param $bundle
-   *   Name of the bundle
-   *   Default = NULL
+   * @param string[] $bundles
+   *   A list of bundle IDs. Defaults to [].
+   *
    * @return string
    *   Returns the generated field name
    */
-  public function createEntityReferenceField($target_type, $bundle = NULL) {
+  protected function createEntityReferenceField($target_type, $bundles = []) {
     // Generates a bundle path for the newly created content type.
     $bundle_path = 'admin/structure/types/manage/' . $this->type;
 
@@ -381,7 +444,7 @@ public function createEntityReferenceField($target_type, $bundle = NULL) {
 
     $storage_edit = $field_edit = array();
     $storage_edit['settings[target_type]'] = $target_type;
-    if ($bundle) {
+    foreach ($bundles as $bundle) {
       $field_edit['settings[handler_settings][target_bundles][' . $bundle . ']'] = TRUE;
     }
 
@@ -391,7 +454,6 @@ public function createEntityReferenceField($target_type, $bundle = NULL) {
     return $field_name;
   }
 
-
   /**
    * Checks if a select element contains the specified options.
    *
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceAutoCreateTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceAutoCreateTest.php
index dc87dc8..e9489e5 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceAutoCreateTest.php
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceAutoCreateTest.php
@@ -7,7 +7,10 @@
 
 namespace Drupal\entity_reference\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
+use Drupal\field\Entity\FieldConfig;
+use Drupal\taxonomy\Entity\Vocabulary;
 use Drupal\simpletest\WebTestBase;
 use Drupal\node\Entity\Node;
 
@@ -18,7 +21,9 @@
  */
 class EntityReferenceAutoCreateTest extends WebTestBase {
 
-  public static $modules = array('entity_reference', 'node');
+  use EntityReferenceTestTrait;
+
+  public static $modules = ['entity_reference', 'node', 'taxonomy'];
 
   /**
    * The name of a content type that will reference $referencedType.
@@ -82,6 +87,9 @@ protected function setUp() {
         'type' => 'entity_reference_autocomplete',
       ))
       ->save();
+
+    $account = $this->drupalCreateUser(['access content', "create $this->referencingType content"]);
+    $this->drupalLogin($account);
   }
 
   /**
@@ -89,9 +97,6 @@ protected function setUp() {
    * entity.
    */
   public function testAutoCreate() {
-    $user1 = $this->drupalCreateUser(array('access content', "create $this->referencingType content"));
-    $this->drupalLogin($user1);
-
     $this->drupalGet('node/add/' . $this->referencingType);
     $this->assertFieldByXPath('//input[@id="edit-test-field-0-target-id" and contains(@class, "form-autocomplete")]', NULL, 'The autocomplete input element appears.');
 
@@ -134,4 +139,103 @@ public function testAutoCreate() {
     $this->assertText($referencing_node->label(), 'Referencing node label found.');
     $this->assertText($referenced_node->label(), 'Referenced node label found.');
   }
+
+  /**
+   * Tests if a entity reference field having multiple target bundles is storing
+   * the auto-created entity in the right destination.
+   */
+  public function testMultipleTargetBundles() {
+    /** @var \Drupal\taxonomy\Entity\Vocabulary[] $vocabularies */
+    $vocabularies = [];
+    for ($i = 0; $i < 2; $i++) {
+      $vid = Unicode::strtolower($this->randomMachineName());
+      $vocabularies[$i] = Vocabulary::create([
+        'name' => $this->randomMachineName(),
+        'vid' => $vid,
+      ]);
+      $vocabularies[$i]->save();
+    }
+
+    // Create a taxonomy term entity reference field that saves the auto-created
+    // taxonomy terms in the second vocabulary from the two that were configured
+    // as targets.
+    $field_name = Unicode::strtolower($this->randomMachineName());
+    $handler_settings = [
+      'target_bundles' => [
+        $vocabularies[0]->id() => $vocabularies[0]->id(),
+        $vocabularies[1]->id() => $vocabularies[1]->id(),
+      ],
+      'auto_create' => TRUE,
+      'auto_create_bundle' => $vocabularies[1]->id(),
+    ];
+    $this->createEntityReferenceField('node', $this->referencingType, $field_name, $this->randomString(), 'taxonomy_term', 'default', $handler_settings);
+    /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $fd */
+    entity_get_form_display('node', $this->referencingType, 'default')
+      ->setComponent($field_name, ['type' => 'entity_reference_autocomplete'])
+      ->save();
+
+    $term_name = $this->randomString();
+    $edit = [
+      $field_name . '[0][target_id]' => $term_name,
+      'title[0][value]' => $this->randomString(),
+    ];
+
+    $this->drupalPostForm('node/add/' . $this->referencingType, $edit, 'Save');
+    /** @var \Drupal\taxonomy\Entity\Term $term */
+    $term = taxonomy_term_load_multiple_by_name($term_name);
+    $term = reset($term);
+
+    // The new term is expected to be stored in the second vocabulary.
+    $this->assertEqual($vocabularies[1]->id(), $term->bundle());
+
+    /** @var \Drupal\field\Entity\FieldConfig $field_config */
+    $field_config = FieldConfig::loadByName('node', $this->referencingType, $field_name);
+    $handler_settings = $field_config->getSetting('handler_settings');
+
+    // Change the field setting to store the auto-created terms in the first
+    // vocabulary and test again.
+    $handler_settings['auto_create_bundle'] = $vocabularies[0]->id();
+    $field_config->setSetting('handler_settings', $handler_settings);
+    $field_config->save();
+
+    $term_name = $this->randomString();
+    $edit = [
+      $field_name . '[0][target_id]' => $term_name,
+      'title[0][value]' => $this->randomString(),
+    ];
+
+    $this->drupalPostForm('node/add/' . $this->referencingType, $edit, 'Save');
+    /** @var \Drupal\taxonomy\Entity\Term $term */
+    $term = taxonomy_term_load_multiple_by_name($term_name);
+    $term = reset($term);
+
+    // The second term is expected to be stored in the first vocabulary.
+    $this->assertEqual($vocabularies[0]->id(), $term->bundle());
+
+    // Test the case when the field config settings are inconsistent.
+    unset($handler_settings['auto_create_bundle']);
+    $field_config->setSetting('handler_settings', $handler_settings);
+    $field_config->save();
+
+    // If we use $this->drupalGet() we cannot catch the exception because the
+    // form builder runs in other PHP space. Instead we are only building the
+    // form in order to check if the exception is thrown.
+    try {
+      /** @var \Drupal\Core\Form\FormBuilderInterface $form_builder */
+      $form_builder = $this->container->get('entity.form_builder');
+      $form_builder->getForm(Node::load(1));
+      $this->fail("Missed 'auto_create_bundle' should throw \\InvalidArgumentException but it didn't.");
+    }
+    catch (\InvalidArgumentException $e) {
+      $this->assertIdentical(
+        $e->getMessage(),
+        sprintf(
+          "Create referenced entities if they don't already exist option is enabled but a specific destination bundle is not set. You should re-visit and fix the settings of the '%s' (%s) field.",
+          $field_config->getLabel(),
+          $field_config->getName()
+        )
+      );
+    }
+  }
+
 }
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceSettingsTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceSettingsTest.php
new file mode 100644
index 0000000..3a59b14
--- /dev/null
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceSettingsTest.php
@@ -0,0 +1,127 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\entity_reference\Tests\EntityReferenceSettingsTest.
+ */
+
+namespace Drupal\entity_reference\Tests;
+
+use Drupal\Component\Utility\Unicode;
+use Drupal\field\Entity\FieldConfig;
+use Drupal\node\Entity\NodeType;
+use Drupal\simpletest\KernelTestBase;
+use Drupal\taxonomy\Entity\Vocabulary;
+
+/**
+ * Tests entity reference field settings.
+ *
+ * @group entity_reference
+ */
+class EntityReferenceSettingsTest extends KernelTestBase {
+
+  use EntityReferenceTestTrait;
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['node', 'taxonomy', 'field', 'user', 'text', 'entity_reference'];
+
+  /**
+   * Testing node type ID.
+   *
+   * @var string
+   */
+  protected $nodeType;
+
+  /**
+   * Testing taxonomy vocabulary IDs.
+   *
+   * @var string[]
+   */
+  protected $vids = [];
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setup();
+
+    $this->installEntitySchema('node');
+    $this->installEntitySchema('taxonomy_term');
+
+    $this->nodeType = Unicode::strtolower($this->randomMachineName());
+    NodeType::create([
+      'type' => $this->nodeType,
+      'name' => $this->randomString(),
+    ])->save();
+
+    // Create 3 taxonomy vocabularies.
+    $this->vids = ['vid1', 'vid2', 'vid3'];
+    $this->vids = array_combine($this->vids, $this->vids);
+    foreach ($this->vids as $vid) {
+      Vocabulary::create([
+        'vid' => $vid,
+        'name' => $this->randomString(),
+      ])->save();
+    }
+  }
+
+  /**
+   * Tests dependencies.
+   */
+  public function testDependency() {
+    /** @var \Drupal\Core\Config\ConfigFactoryInterface $factory */
+    $factory = $this->container->get('config.factory');
+
+    $name = Unicode::strtolower($this->randomMachineName());
+    $label = $this->randomString();
+    $handler_settings = [
+      'target_bundles' => $this->vids,
+      'auto_create' => TRUE,
+      'auto_create_bundle' => 'vid1',
+    ];
+
+    // Create an entity reference field with auto creation, targeting 3 taxonomy
+    // vocabularies. Set the first vocabulary as 'auto_create_bundle'.
+    $this->createEntityReferenceField('node', $this->nodeType, $name, $label, 'taxonomy_term', 'default', $handler_settings);
+    $id = "field.field.node.{$this->nodeType}.$name";
+
+    // Test field creation.
+    $config = $factory->get($id);
+    $this->assertIdentical($config->get('settings.handler_settings.target_bundles'), $this->vids);
+    $this->assertTrue($config->get('settings.handler_settings.auto_create'));
+    $this->assertIdentical($config->get('settings.handler_settings.auto_create_bundle'), 'vid1');
+
+    // Delete the first vocabulary.
+    Vocabulary::load('vid1')->delete();
+
+    // Reload the field config and test again.
+    $config = $factory->getEditable($id);
+
+    $this->assertIdentical($config->get('settings.handler_settings.target_bundles'), ['vid2' => 'vid2', 'vid3' => 'vid3']);
+    // 'auto_create' is FALSE.
+    $this->assertFalse($config->get('settings.handler_settings.auto_create'));
+    // 'auto_create_bundle' is NULL.
+    $this->assertNull($config->get('settings.handler_settings.auto_create_bundle'));
+
+    // Set the 'auto_create_bundle' to 'vid2', 'auto_create' to TRUE.
+    $config
+      ->set('settings.handler_settings.auto_create', TRUE)
+      ->set('settings.handler_settings.auto_create_bundle', 'vid2')
+      ->save();
+
+    // Delete the second vocabulary.
+    Vocabulary::load('vid2')->delete();
+
+    // Reload the field config and test again.
+    $config = $factory->get($id);
+
+    $this->assertIdentical($config->get('settings.handler_settings.target_bundles'), ['vid3' => 'vid3']);
+    // 'auto_create' is TRUE.
+    $this->assertTrue($config->get('settings.handler_settings.auto_create'));
+    // 'auto_create_bundle' was automatically moved to 'vid3'.
+    $this->assertIdentical($config->get('settings.handler_settings.auto_create_bundle'), 'vid3');
+  }
+
+}
diff --git a/core/modules/taxonomy/src/Plugin/EntityReferenceSelection/TermSelection.php b/core/modules/taxonomy/src/Plugin/EntityReferenceSelection/TermSelection.php
index ddf99ca..7c62d8c 100644
--- a/core/modules/taxonomy/src/Plugin/EntityReferenceSelection/TermSelection.php
+++ b/core/modules/taxonomy/src/Plugin/EntityReferenceSelection/TermSelection.php
@@ -38,21 +38,13 @@ public function entityQueryAlter(SelectInterface $query) {
    */
   public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
     $form = parent::buildConfigurationForm($form, $form_state);
-
     $form['target_bundles']['#title'] = $this->t('Vocabularies');
-    // @todo: Currently allow auto-create only on taxonomy terms.
-    $form['auto_create'] = array(
-      '#type' => 'checkbox',
-      '#title' => $this->t("Create referenced entities if they don't already exist"),
-      '#default_value' => isset($this->configuration['handler_settings']['auto_create']) ? $this->configuration['handler_settings']['auto_create'] : FALSE,
-    );
 
     // Sorting is not possible for taxonomy terms because we use
     // \Drupal\taxonomy\TermStorageInterface::loadTree() to retrieve matches.
     $form['sort']['#access'] = FALSE;
 
     return $form;
-
   }
 
   /**
