How does the UserData plugin get the correct value?
The available fields for the user entity are defined in Drupal\user\UserViewsData::getViewsData():

$data['users']['data'] = [
  'title' =&gt; $this-&gt;t('Data'),
  'help' =&gt; $this-&gt;t('Provides access to the user data service.'),
  'real field' =&gt; 'uid',
  'field' =&gt; [
    'id' =&gt; 'user_data',
  ],
];


This attaches the field user_data to the user entity.