diff --git a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
index eed8739..e4ec223 100644
--- a/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
+++ b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
@@ -167,6 +167,7 @@ public static function validateEntityAutocomplete(array &$element, FormStateInte
           // Auto-create item. See an example of how this is handled in
           // \Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::presave().
           $value[] = array(
+            'target_id' => NULL,
             'entity' => static::createNewEntity($element['#target_type'], $element['#autocreate']['bundle'], $input, $element['#autocreate']['uid'])
           );
         }
diff --git a/core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php b/core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php
index ee45c7d..3d1e33e 100644
--- a/core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php
+++ b/core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php
@@ -27,12 +27,12 @@ public function referencedEntities() {
     // "autocreate" entities that are already populated in $item->entity.
     $target_entities = $ids = array();
     foreach ($this->list as $delta => $item) {
-      if ($item->hasNewEntity()) {
-        $target_entities[$delta] = $item->entity;
-      }
-      elseif ($item->target_id !== NULL) {
+      if ($item->target_id !== NULL) {
         $ids[$delta] = $item->target_id;
       }
+      elseif ($item->hasNewEntity()) {
+        $target_entities[$delta] = $item->entity;
+      }
     }
 
     // Load and add the existing entities.
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
index fa0b4a0..0eb327f 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
@@ -39,13 +39,6 @@
 class EntityReferenceItem extends FieldItemBase {
 
   /**
-   * Marker value to identify a newly created entity.
-   *
-   * @var int
-   */
-  protected static $NEW_ENTITY_MARKER = -1;
-
-  /**
    * {@inheritdoc}
    */
   public static function defaultStorageSettings() {
@@ -177,12 +170,8 @@ public function setValue($values, $notify = TRUE) {
         $this->onChange('entity', FALSE);
       }
       elseif (isset($values['target_id']) && isset($values['entity'])) {
-        // If both properties are passed, verify the passed values match. The
-        // only exception we allow is when we have a new entity: in this case
-        // its actual id and target_id will be different, due to the new entity
-        // marker.
-        $entity_id = $this->get('entity')->getTargetIdentifier();
-        if ($entity_id != $values['target_id'] && ($values['target_id'] != static::$NEW_ENTITY_MARKER || !$this->entity->isNew())) {
+        // If both properties are passed, verify the passed values match.
+        if ($this->get('entity')->getTargetIdentifier() != $values['target_id']) {
           throw new \InvalidArgumentException('The target id and entity passed to the entity reference item do not match.');
         }
       }
@@ -191,7 +180,6 @@ public function setValue($values, $notify = TRUE) {
         $this->parent->onChange($this->getName());
       }
     }
-
   }
 
   /**
@@ -213,14 +201,12 @@ public function getValue() {
    */
   public function onChange($property_name, $notify = TRUE) {
     // Make sure that the target ID and the target property stay in sync.
-    if ($property_name == 'entity') {
-      $property = $this->get('entity');
-      $target_id = $property->isTargetNew() ? static::$NEW_ENTITY_MARKER : $property->getTargetIdentifier();
-      $this->writePropertyValue('target_id', $target_id);
-    }
-    elseif ($property_name == 'target_id' && $this->target_id != static::$NEW_ENTITY_MARKER) {
+    if ($property_name == 'target_id') {
       $this->writePropertyValue('entity', $this->target_id);
     }
+    elseif ($property_name == 'entity') {
+      $this->writePropertyValue('target_id', $this->get('entity')->getTargetIdentifier());
+    }
     parent::onChange($property_name, $notify);
   }
 
@@ -242,6 +228,8 @@ public function isEmpty() {
    * {@inheritdoc}
    */
   public function preSave() {
+    print_r($this->target_id);
+    echo PHP_EOL;
     if ($this->hasNewEntity()) {
       // Save the entity if it has not already been saved by some other code.
       if ($this->entity->isNew()) {
@@ -251,6 +239,9 @@ public function preSave() {
       // react properly.
       $this->target_id = $this->entity->id();
     }
+    if (empty($this->target_id) && $this->entity) {
+      $this->target_id = $this->entity->id();
+    }
   }
 
   /**
@@ -276,7 +267,7 @@ public static function generateSampleValue(FieldDefinitionInterface $field_defin
    *   TRUE if the item holds an unsaved entity.
    */
   public function hasNewEntity() {
-    return $this->target_id === static::$NEW_ENTITY_MARKER;
+    return ($entity = $this->entity) && $entity->isNew();
   }
 
   /**
diff --git a/core/modules/system/src/Tests/Entity/EntityReferenceFieldTest.php b/core/modules/system/src/Tests/Entity/EntityReferenceFieldTest.php
index 14a67ef..5b90096 100644
--- a/core/modules/system/src/Tests/Entity/EntityReferenceFieldTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityReferenceFieldTest.php
@@ -238,10 +238,9 @@ function testAutocreateApi() {
     });
     $this->assertUserAutocreate($entity, function(EntityInterface $entity, UserInterface $user) {
       $entity->user_id[0]->get('entity')->setValue($user);
-      $entity->user_id[0]->get('target_id')->setValue(-1);
     });
     $this->assertUserAutocreate($entity, function(EntityInterface $entity, UserInterface $user) {
-      $entity->user_id->setValue(array('entity' => $user, 'target_id' => -1));
+      $entity->user_id->setValue(array('entity' => $user));
     });
     try {
       $message = 'Setting both the entity and an invalid target_id property fails.';
@@ -273,10 +272,9 @@ function testAutocreateApi() {
     });
     $this->assertUserRoleAutocreate($entity, function(EntityInterface $entity, RoleInterface $role) {
       $entity->user_role[0]->get('entity')->setValue($role);
-      $entity->user_role[0]->get('target_id')->setValue(-1);
     });
     $this->assertUserRoleAutocreate($entity, function(EntityInterface $entity, RoleInterface $role) {
-      $entity->user_role->setValue(array('entity' => $role, 'target_id' => -1));
+      $entity->user_role->setValue(array('entity' => $role));
     });
     try {
       $message = 'Setting both the entity and an invalid target_id property fails.';
