chain_dir returned the chain name for every non-signet chain, but mainnet stores its data in the top-level data directory. Mainnet tests worked around this by setting the chain to the empty string, which doubles as the datadir name.
Instead of this workaround, map "main" to an empty datadir, and translate it to no chain argument and no config section in write_config, so tests can name the chain the way the rest of the codebase does.
This was mentioned in #34566 (review).