All instances of block are not getting removed
As mentioned in the other question, what you need to do is query for the blocks that no longer exist and delete them.

BlockContent::delete()/getInstances() is an example for that. You can do a similar query, either by using entity_load_by_properties() for the plugin ID that those blocks would have. Or you can run an entity query, which has more options.

You don't have an entity, so in your submit, you need to build a list of all unchecked options and then query for those. The advantage of doing an entity query is that you can do an IN condition, so you probably want to use that.

A more complicated example, that looks at settings and either updates or deletes the affected blocks can be found in simplenews.module's Newsletter::postDelete():

if (\Drupal::moduleHandler()-&gt;moduleExists('block')) {
  // Make sure there are no active blocks for these newsletters.
  $ids = \Drupal::entityQuery('block')
    -&gt;condition('plugin', 'simplenews_subscription_block')
    -&gt;condition('settings.newsletters.*', array_keys($entities), 'IN')
    -&gt;execute();
  if ($ids) {
    $blocks = Block::loadMultiple($ids);
    foreach ($blocks as $block) {
      $settings = $block-&gt;get('settings');
      foreach ($entities as $newsletter) {
        if (in_array($newsletter-&gt;id(), $settings['newsletters'])) {
          unset($settings['newsletters'][array_search($newsletter-&gt;id(), $settings['newsletters'])]);
        }
      }
      // If there are no enabled newsletters left, delete the block.
      if (empty($settings['newsletters'])) {
        $block-&gt;delete();
      }
      else {
        // otherwise, update the settings and save.
        $block-&gt;set('settings', $settings);
        $block-&gt;save();
      }
    }
  }
}