DB reconnect after SQL Gone Away / None of the master DB servers is available

When the MySQL server is temporarily unavailable due to connection issues, server hick-ups,… a DB command encounters the Gone Away error, communicated with a yii\db\Exception. I can catch this case via the yii\db\Command->setRetryHandler() callback function, so my approach would be to reestablish the DB connection with a

$this->db->close();
$this->db->open();

call in this callback.
The problem is that calling $this->db->open(); can end up in a

InvalidConfigException('None of the master DB servers is available.')

exception when the master connection is unreachable for a couple of seconds. I wanted to catch this case, too, and set a small wait delay for another reconnection try.
The problem is, then calling $this->db->open(); again will fail as yii\db\Connection->_master has been set to NULL after the last failed attempt which prohibits any further reconnection attempts (see yii\db\Connection::getMaster() , the if condition $this->_master === false).

How can I enforce another reconnection attempt so $this->_master will hold a new connection again?