How to use DefaultSelection::getReferenceableEntities in custom controller? My Goal:
I want to create a customized entity_autocomplete form field to better fit my needs compared to the default one - making some modifications to the HTML and JS that's being used, as well as how submissions are handled.
Specifically, I want to do something like this but I need more control over the backend, and everything...
What Drupal can do:
Drupal's default entity autocomplete already lets the user type 2 letters, and it finds all entities that contain these 2 letters.

My Problem:
Unfortunately I have trouble figuring out how to use the existing &quot;search feature&quot; if you will call it that.
Some Considerations:
I looked into using search API, but this was similarly overwhelming. Considering that this functionality I'm looking for is already built into Drupal, I figure I can just re-implement it, without any additional modules, right? Really, I'm just re-designing the UI. And even if I need to beef it up in the future with a faster, resource saving search engine, I can just replace that aspect of my module/controller. (If someone can point out how to use Search API to do what I need, I'd be happy to listen)
What I've done so far:
I have already created my own custom route that points to a JSON controller which will accept the search parameters.
Based on all my research I figured I need to add use Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection; to the top.
I see that DefaultSelection::getReferenceableEntities seems to do exactly what I need it to do.
However, the constructor for this class has 9 different parameters, many of them classes which I know nothing about.
But there is a create method, which apparently allows you to inject configuration data, but also it requires a ContainerInterface.
So here's where I'm lost...
How exactly do I make use of DefaultSelection::getReferenceableEntities in my custom controller?
Okay, it took me over 2 weeks to get to the bottom of this, but turns out, that DefaultSelection::getReferenceableEntities is just a wrapper for Drupal::entityQuery. This becomes especially clear when realizing that DefaultSelection::getReferenceableEntities makes a call to DefaultSelection::buildEntityQuery. And this method is only a complicated way to make a customized query.
So for my purposes, all I had to do was learn about entity queries. Here's how I ended up performing a search:
For taxonomy terms
            $query = \Drupal::entityQuery('taxonomy_term'); 
            $query-&gt;condition('vid', 'my_taxonomy_terms'); //select the collection
            $query-&gt;condition('name', $search_term, 'CONTAINS'); //searching the title for a search term
            $term_ids= $query-&gt;execute();
            $terms = \Drupal\taxonomy\Entity\Term::loadMultiple($term_ids);  //process the nodes however is desired

            $result = [];

            foreach($terms as $term){
              $result[$term-&gt;id()] = $term-&gt;getName();
            }

            return $result;

For other entities and nodes
            $query = \Drupal::entityQuery('node'); 
            $query-&gt;condition('field_somefield', 'somevalue'); //optional condition to filter results by
            $query-&gt;condition('title', $search_term, 'CONTAINS'); //searching the title for a search term
            $node_ids = $query-&gt;execute();
            $nodes = \Drupal::entityTypeManager()-&gt;getStorage('node')-&gt;loadMultiple($node_ids); //process the nodes however is desired

            $result = [];

            foreach($nodes as $node){
              $result[$node-&gt;id()] = $node-&gt;getTitle();
            }

            return $result; 

Reference: https://api.drupal.org/api/drupal/core!lib!Drupal.php/function/Drupal%3A%3AentityQuery/8.2.x