How to change the url the core search form submits to?
You can use hook_form_alter or hook_form_FORM_ID_alter to alter a form.
Core's search block form has a form id of search_block_form, so you could implement with hook_form_FORM_ID_alter() like:
use Drupal\Core\Form\FormStateInterface;

function mymodule_form_search_block_form_alter(&amp;$form, FormStateInterface $form_state) {
  $form['#action'] = '/my-custom-path';
}