Modify token used in path URL alias generation
We found the solution using the sample found on How To Create A Custom Token In Drupal 8?

Code

/**
 * Implements hook_token_info().
 */
function my_module_token_token_info() {
  $info = [];
  $info['types']['my_token_group'] = ['name' =&gt; t('Custom Group'), 'description' =&gt; t('Custom Group')];
  $info['tokens']['my_token_group’][‘my_token’][] = 'A token to extract desired characters from Node body to be used in meta descriptions';
  return $info;
}

/**
 * Implements hook_tokens().
 */
function  my_module_token_tokens($type, $tokens, array $data, array $options, \Drupal\Core\Render\BubbleableMetadata $bubbleable_metadata) {
  $replacements = [];
  if ($type == 'my_token_group') {

    foreach ($tokens as $name =&gt; $original) {
      // Find the desired token by name.
      switch ($name) {
        case ‘my_token’:
          $node = $data['node'];
          if(is_object($node) &amp;&amp; !$node-&gt;myFieldName-&gt;isEmpty()) {
            $token_value = $node-&gt;myFieldName-&gt;value; // or something similar.
          }
          else {
            $token_value = $node-&gt;label();
          }
          $replacements[$original] = $token_value;
          break;
      }
    }
  }
  return $replacements;
}