Edit CKEditor's config programmatically
I had a similar case, i had to add a few attributes to the basic_html format in the Allowed HTML tags so it could work with the module editor_advance_link which allows the users to add title, class, id and target attributes to the a tag when using the core's CKEditor.

So this is what i did with some code i found here ( https://www.drupal.org/files/issues/allow_image_style_to_be-2061377-224.patch)

if ($filter = FilterFormat::load('basic_html')) {
    if (($filter_html = $filter-&gt;filters('filter_html')) &amp;&amp; $filter_html-&gt;status) {
      $config = $filter_html-&gt;getConfiguration();
      $allowed_html = !empty($config['settings']['allowed_html']) ? $config['settings']['allowed_html'] : NULL;
      $matches = [];
      if ($allowed_html &amp;&amp; preg_match('/&lt;a ([^&gt;]*)&gt;/', $allowed_html, $matches)) {
        $new_attributes = array_filter(explode(' ', $matches[1]));
        $new_attributes[] = 'target';
        $new_attributes[] = 'title';
        $new_attributes[] = 'class';
        $config['settings']['allowed_html'] = preg_replace('/&lt;a ([^&gt;]*)&gt;/', '&lt;a ' . implode(' ', array_unique($new_attributes)) . '&gt;', $allowed_html);
        $filter-&gt;setFilterConfig('filter_html', $config);
        $filter-&gt;save();
      }
    }
  }


Don't forget to include:
use Drupal\filter\Entity\FilterFormat;

This code is needed to be run only once, so i had to include it in a .install file in a custom module.