A method getUniqueMachineName has been added to Drupal\block\BlockRepositoryInterface. This method can be used to generate a unique machine name for a block.
A default implementation of this method has been added to Drupal\block\BlockRepository.
During theme initialization, block_theme_initialize() now uses this to ensure blocks that are created with a machine name that is already in use before installation are made unique. A number will be appended to the new block if a collision is found.
Additionally the constructor of Drupal\block\BlockForm has an additional argument $block_repository that implements Drupal\block\BlockRepository. Calling Drupal\block\BlockForm::__construct without the $block_repository argument is deprecated.