Which IE are you using? I tried this in 8 and the popup appears on top of the basemap gallery(see screen shot attached).
While it works, I would not recommend doing this. This is a subjective point, but I think that when the basemap gallery opens, it should appear on top of the popup. My reasoning is that by clicking the basemap gallery, the user has said "show me the basemap gallery". If you show the basemap gallery, but with the popup on top, you're hiding the information your user just requested. Personally, I would find this frustrating if I had to jiggle the map around to get the popup out of the way so I could see all of the basemap gallery.