VBO hook_entity_update
Your problem is that you are using routeMatch() to get the node id, which won't be returned when using VBO.
You said you're using hook_entity_update():
function hook_ENTITY_TYPE_update(Drupal\Core\Entity\EntityInterface $entity)

This code assumes that the entity you are running hook_entity_update() for is the node entity.
Since the hook provides the $entity object, you can get the node id like this:
$nid = $entity-&gt;id()