When UserFactory was introduced in T253432, a change was made to the signature of newFromName. User::newFromName accepts string|bool for the $validation param, but UserFactory::newFromName casts it to a string.
If User::newFromName is called with $validate = false, then User::getCanonicalName picks a default validation strategy: https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/refs/changes/44/598144/6/includes/user/User.php#1135
But if false is passed to UserFactory::newFromName, it is cast to empty string, so it fails the above check and is never set to a valid strategy. An error is then thrown in UserNameUtils::getCanonical: https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/refs/changes/44/598144/6/includes/user/UserNameUtils.php#300