Fixes #4591. The extra code already existed in the only other user of `unresolveNameGlobal` (in the pretty printer), although I did not make it use this function because it has some additional behavior around universes and in pattern position.