Mongo will auto failover if you have 3+ replicas. Primary knowledge is abstracted into the driver or query router level depending on setup.
This can be implemented in front of any RDBMS as a separate layer. Traditionally they weren't designed for quorum-sensing since it hadn't been invented yet. I'd be surprised if something like pgbouncer couldn't do it.