/**
 * Implements hook_migrate_MIGRATION_ID_prepare_row().
 */
function {{ machine_name }}_migrate_MIGRATION_ID_prepare_row(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) {
  $value = $source->getDatabase()->query('SELECT value FROM {variable} WHERE name = :name', [':name' => 'mymodule_filter_foo_' . $row->getSourceProperty('format')])->fetchField();
  if ($value) {
    $row->setSourceProperty('settings:mymodule:foo', unserialize($value));
  }
}