add role to existing user on hook_entity_presave
Code should look like this, as an example:

use Drupal\Core\Entity\EntityInterface;
use Drupal\user\Entity\User;

function mymodule_entity_presave(EntityInterface $entity) {
  if ($entity instanceof AccountInterface &amp;&amp; $entity-&gt;isTranslatable()) {
    $user = User::load($entity-&gt;id());
    $user-&gt;addRole('foobar');
  }
}


Or better yet, hook_ENTITY_TYPE_presave():

use Drupal\Core\Entity\EntityInterface;
use Drupal\user\Entity\User;

function mymodule_user_presave(EntityInterface $entity) {
  $user = User::load($entity-&gt;id());
  $user-&gt;addRole('foobar');
}


Simply using hook_entity_presave will fire for any entity about to be saved. So you either need to check the incoming entity, or use the second hook to isolate it.