operations/software's maintain-replicas/maintain-replicas.pl parses operations/mediawiki-config's wmf-config/InitialiseSettings.php and queries the online API of the individual wikis to extract information about namespaces or case sensitivity of page titles. This is overly complex for a simple task and introduces a number of possible points of failures (change of syntax, network issues, etc.).
Instead there should be a published and updated pattern on how to extract the information directly in PHP from operations/mediawiki-config. In T50626, @liangent and I played around a bit with something like:
include ($MediaWikiRepoPath . "/includes/Defines.php"); include ($WmfConfigRepoPath . "/wmf-config/InitialiseSettings.php"); var_dump ($wgConf->settings);
but it didn't yield all the wanted information.
A solution that only requires the source code repositories, but no network access & Co. would not only profit maintain-replicas.pl, but also other (Labs and not-Labs) tools that need to query this data.