Add cache context to altered links
Since you can't have the role sensitivity reliably in the links themselves, I'd tackle this differently by using an intermediary routing function.

So if you have a link you want to point to mypath/role_1, mypath/role_2 etc, you might point it to role_route/somekey defined in mymodule.routing.yml like so:

mymodule.role_route:
 path: 'role_route/{key}'
 defaults: 
  _controller: '\Drupal\mymodule\Controller\RoleRouteController::route' 
 requirements: 
   _permission: 'access role paths' 


The route function of the controller might be something like:

function route($key) {
  $current_user = \Drupal::currentUser();
  $roles = $current_user-&gt;getRoles();
  // logic to process roles and key to get wanted route
  ...
  $role_route_name = ... ;
  return new RedirectResponse( Url::fromRoute($role_route_name);
}