Does Entity Autocomplete has database leak?
Known bug:
https://www.drupal.org/project/drupal/issues/2826826#comment-12376276


  As mentioned in IRC, the problem with adding even just the entity
  id/UUID to those options is that we create entity * entity reference
  key value entries.
  
  The key is based on the hash, so an ID/UUID in there results in a
  different hash for every entity. At the very least, we would need to
  switch to an expirable key value store, so we can clean them up but it
  is still a non-trivial overhead that is being added.


https://www.drupal.org/project/drupal/issues/2826826#comment-12644652

Seems to fix it for me:

    // Don't serialise the entity, it will be added explicitly afterwards.
if (isset($selection_settings['entity']) &amp;&amp; ($selection_settings['entity'] instanceof EntityInterface)) {
  $element['#autocomplete_query_parameters']['host_entity_type'] = $selection_settings['entity']-&gt;getEntityTypeId();
  $element['#autocomplete_query_parameters']['host_entity_id'] = $selection_settings['entity']-&gt;id();
  unset($selection_settings['entity']);
}