diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 91d27e8..2a75844 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -1155,6 +1155,11 @@ function node_access_rebuild($batch_mode = FALSE) {
       // quickly.
       $entity_query = \Drupal::entityQuery('node');
       $entity_query->sort('nid', 'DESC');
+      // Disable access checking since all nodes must be processed even if the
+      // user does not have access. And unless the current user has the bypass
+      // node access permission, no nodes are accessible since the grants have
+      // just been deleted.
+      $entity_query->accessCheck(false);
       $nids = $entity_query->execute();
       foreach ($nids as $nid) {
         $node_storage->resetCache(array($nid));
@@ -1204,6 +1209,11 @@ function _node_access_rebuild_batch_operation(&$context) {
   $nids = \Drupal::entityQuery('node')
     ->condition('nid', $context['sandbox']['current_node'], '>')
     ->sort('nid', 'ASC')
+    // Disable access checking since all nodes must be processed even if the
+    // user does not have access. And unless the current user has the bypass
+    // node access permission, no nodes are accessible since the grants have
+    // just been deleted.
+    ->accessCheck(false)
     ->range(0, $limit)
     ->execute();
   $node_storage->resetCache($nids);
diff --git a/core/modules/node/src/Tests/NodeAccessBaseTableTest.php b/core/modules/node/src/Tests/NodeAccessBaseTableTest.php
index 91547c4..1bd3230 100644
--- a/core/modules/node/src/Tests/NodeAccessBaseTableTest.php
+++ b/core/modules/node/src/Tests/NodeAccessBaseTableTest.php
@@ -171,6 +171,22 @@ function testNodeAccessBasic() {
     // This user should be able to see all of the nodes on the relevant
     // taxonomy pages.
     $this->assertTaxonomyPage(TRUE);
+
+    // Rebuild the node access permissions, repeat the test. This is done to
+    // ensure that node access is rebuilt correctly even if the current user
+    // does not have the bypass node access permission.
+    node_access_rebuild();
+
+    foreach ($this->nodesByUser as $private_status) {
+      foreach ($private_status as $nid => $is_private) {
+        $this->drupalGet('node/' . $nid);
+        $this->assertResponse(200);
+      }
+    }
+
+    // This user should be able to see all of the nodes on the relevant
+    // taxonomy pages.
+    $this->assertTaxonomyPage(TRUE);
   }
 
   /**
