Core PostgreSQL only gives you the promote command; detecting the failure, choosing a standby and fencing the old primary is done by external tools such as Patroni or repmgr.