How to alter the parameters in the core.services.yml file programatically?
You need a compiler pass:

Compiler passes give you an opportunity to manipulate other service
definitions that have been registered with the service container.

There are some Drupal specifics. An example which calculates a container parameter depending on tagged services is RegisterSerializationClassesCompilerPass. This class is registered in SerializationServiceProvider.
For simple use cases, where you don't need control over compiler pass priorities, you can use the alter() method of ServiceModifierInterface. This will then be executed in a shared core compiler pass ModifyServiceDefinitionsPass.
Example for adding foo to the filter protocols:
src/MymoduleServiceProvider.php
&lt;?php

namespace Drupal\mymodule;

use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceProviderBase;

/**
 * Defines a service provider for the Mymodule module.
 */
class MymoduleServiceProvider extends ServiceProviderBase {

  /**
   * {@inheritdoc}
   */
  public function alter(ContainerBuilder $container) {
    $filter_protocols = $container-&gt;getParameter('filter_protocols');
    $filter_protocols[] = 'foo';
    $container-&gt;setParameter('filter_protocols', $filter_protocols);
  }

}