Gets the selection handler for a given entity_reference field.
\Drupal\entity_reference\Plugin\Type\Selection\SelectionInterface
function entity_reference_get_selection_handler($field, $instance, EntityInterface $entity = NULL) {
$options = array(
'field' => $field,
'instance' => $instance,
'entity' => $entity,
);
return Drupal::service('plugin.manager.entity_reference.selection')
->getInstance($options);
}