How to run custom code on rollback?
You want to use prepareRollback() because at that point the thing that you are rolling back has not been removed yet.

public function prepareRollback($entity_id) {
  parent::prepareRollback();
  // Code to execute before an entity has been rolled back
}


Take a look at this guide for more info.