Some #states not working for custom field but do work on identical webform field
Webform form elements have additional goodies, not available in Drupal Core. But you can add those additional features with just a few lines of code:
&lt;?php
public function buildForm(array $form, FormStateInterface $form_state) {
 $config = $this-&gt;config('custom_module');
 // Define the element(s).
 $form['nodes'] = [
   '#type' =&gt; 'entity_autocomplete',
   '#title' =&gt; $this-&gt;t('Select favorite articles.'),
   '#multiple' =&gt; 15,
   '#target_type' =&gt; 'node',
   '#selection_handler' =&gt; 'default:node',
   '#selection_settings' =&gt; [
     'target_bundles' =&gt; ['article' =&gt; 'article'],
     'sort' =&gt; ['field' =&gt; 'title', 'direction' =&gt; 'ASC'],
   ],
   '#default_value' =&gt; $config-&gt;get('nodes'),
 ];
 // Process the element(s).
 $this-&gt;elementManager-&gt;processElement($form['nodes']);
 // Attach behaviors. Unsaved: Warn users about unsaved changes.
 $form['#attributes']['class'][] = 'js-webform-unsaved';
 $form['#attached']['library'][] = 'webform/webform.form.unsaved';
 return parent::buildForm($form, $form_state);
}

Notice the elementManager-&gt;process() and the additional libraries. Watch the video in the linked blog post to get an idea where to get the elementManager and the libraries.
https://www.jrockowitz.com/blog/webform-apis