Select the right pathauto alias for a node
Another option, and I find this to be preferable to altering the token because it's exposed to site builders and makes what's happening perfectly clear in the UI, is to create your own custom token that will return /global or /local for that piece of the url. You just need to implement hook_token_info and hook_tokens. This blog post walks you through the process.

Ex:

/**
 * Implements hook_token_info().
 */
function MY_MODULE_token_info() {
  $info['tokens']['node']['MY_TOKEN_ID'] = [
    'name' =&gt; t('MY TOKEN LABEL'),
    'description' =&gt; t('Return "/global" for nodes with the global checkbox checked, otherwise returns "/local".'),
    'type' =&gt; 'url-fragment',
  ];
  return $info;
}

/**
 * Implements hook_tokens().
 */
function MY_MODULE_tokens($type, $tokens, array $data, array $options, Drupal\Core\Render\BubbleableMetadata $bubbleable_metadata) {
  $replacements = [];
  if ($type == 'node' &amp;&amp; !empty($data['node']) &amp;&amp; isset($tokens['MY_TOKEN_ID'])) {
    $node = $data['node'];
    $global_or_local = '/local';
    if ($node-&gt;hasField('MY_GLOBAL_FIELD') &amp;&amp; !empty($node-&gt;MY_GLOBAL_FIELD-&gt;value)) {
      $global_or_local = '/global';
    }
    $replacements['[node:MY_TOKEN_ID]'] = $global_or_local;
  }
  return $replacements;
}


Note: I'm not sure if that logic to determine global or local is perfect, but it should be close.