how to override module's theme function in a custom module?
You can create a new module use hook_theme_registry_alter like module simplelogin
like this:

/**
 * Implements hook_theme_registry_alter
 *
 * {@inheritdoc}
 */
function YOUR_MODULE_theme_registry_alter(&amp;$theme_registry) {
  $theme_registry['page__simplelogin'][preprocess functions] = [
    0 =&gt; 'simplelogin_preprocess_simplelogin',
    1 =&gt; 'YOUR_MODULE_preprocess_function'
  ];
}