This follows up on changes proposed in bug#45474. The second patch is a bit more controversial, but is probably required if we want more reliable usage of completion commands in non-innermost minibuffers (that is, with minibuffer-follows-selected-frame set to nil.)