diff --git a/core/modules/user/src/RoleForm.php b/core/modules/user/src/RoleForm.php
index ada54dd..bf18327 100644
--- a/core/modules/user/src/RoleForm.php
+++ b/core/modules/user/src/RoleForm.php
@@ -58,6 +58,37 @@ public function save(array $form, FormStateInterface $form_state) {
     $entity->set('label', trim($entity->label()));
     $status = $entity->save();
 
+    // Create actions but ignore the authenticated and anonymous roles.
+    if (!in_array($entity->id(), array(RoleInterface::AUTHENTICATED_ID, RoleInterface::ANONYMOUS_ID))) {
+      $type_manager = $this->entityTypeManager->getStorage('action');
+      $add_id = 'user_add_role_action.' . $entity->id();
+      if (!$type_manager->load($add_id)) {
+        $action = $type_manager->create(array(
+          'id' => $add_id,
+          'type' => 'user',
+          'label' => $this->t('Add the @label role to the selected users', array('@label' => $entity->label())),
+          'configuration' => array(
+            'rid' => $entity->id(),
+          ),
+          'plugin' => 'user_add_role_action',
+        ));
+        $action->trustData()->save();
+      }
+      $remove_id = 'user_remove_role_action.' . $entity->id();
+      if (!$type_manager->load($remove_id)) {
+        $action = $type_manager->create(array(
+          'id' => $remove_id,
+          'type' => 'user',
+          'label' => $this->t('Remove the @label role from the selected users', array('@label' => $entity->label())),
+          'configuration' => array(
+            'rid' => $entity->id(),
+          ),
+          'plugin' => 'user_remove_role_action',
+        ));
+        $action->trustData()->save();
+      }
+    }
+
     $edit_link = $this->entity->link($this->t('Edit'));
     if ($status == SAVED_UPDATED) {
       drupal_set_message($this->t('Role %label has been updated.', array('%label' => $entity->label())));
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index 0e9cedb..235199b 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -976,43 +976,6 @@ function user_role_names($membersonly = FALSE, $permission = NULL) {
 }
 
 /**
- * Implements hook_ENTITY_TYPE_insert() for user_role entities.
- */
-function user_user_role_insert(RoleInterface $role) {
-  // Ignore the authenticated and anonymous roles or the role is being synced.
-  if (in_array($role->id(), array(RoleInterface::AUTHENTICATED_ID, RoleInterface::ANONYMOUS_ID)) || $role->isSyncing()) {
-    return;
-  }
-
-  $add_id = 'user_add_role_action.' . $role->id();
-  if (!entity_load('action', $add_id)) {
-    $action = Action::create(array(
-      'id' => $add_id,
-      'type' => 'user',
-      'label' => t('Add the @label role to the selected users', array('@label' => $role->label())),
-      'configuration' => array(
-        'rid' => $role->id(),
-      ),
-      'plugin' => 'user_add_role_action',
-    ));
-    $action->trustData()->save();
-  }
-  $remove_id = 'user_remove_role_action.' . $role->id();
-  if (!entity_load('action', $remove_id)) {
-    $action = Action::create(array(
-      'id' => $remove_id,
-      'type' => 'user',
-      'label' => t('Remove the @label role from the selected users', array('@label' => $role->label())),
-      'configuration' => array(
-        'rid' => $role->id(),
-      ),
-      'plugin' => 'user_remove_role_action',
-    ));
-    $action->trustData()->save();
-  }
-}
-
-/**
  * Implements hook_ENTITY_TYPE_delete() for user_role entities.
  */
 function user_user_role_delete(RoleInterface $role) {
