Thank you both for your valuable feedback on the previous patch version.
I've reworked the patch based on your suggestions - the new version should address the concerns about ALTER SYSTEM and follows the same patterns as the 'setup_recovery' code.
I kept primary_conninfo as-is for now since I'm not totally sure if we need to touch it