Converting a Views SQL query with INNER JOIN to an EntityQuery
You can try hook_query_TAG_alter
Sample code
$query = $this-&gt;getEntityQuery('taxonomy_term')
  -&gt;condition($entity_type-&gt;getKey('bundle'), 'MY_VOCABULARY')-&gt;addTag('join_flaging');

/**
 * Implements hook_query_TAG_alter().
 */
function MYMODULE_query_join_flagging_alter(Drupal\Core\Database\Query\AlterableInterface $query) {
  $query-&gt;addJoin(&quot;INNER&quot;,&quot;flagging&quot;,&quot;flg&quot;,&quot;taxonomy_term_field_data.tid = flg.entity_id AND (flg.flag_id='MY_FLAG' AND flg.uid='MY_UID')&quot;);
}