Implement support for cascading replication. This would involve:
(a) tracking which server each replica cascades from;
(b) polling that server's pg_stat_replication instead of the master's
(c) auto-remaster when the intermediate master-replica goes down