In your app it looks like you setup the listener for the maps onLoad event but you don't have a mapReady function in your app.
dojo.connect(map, "onLoad", mapReady);
The basemap gallery should be created once the map has loaded so try adding the logic in the mapReady function and it should work.
function mapReady(){
createBasemapGallery();
}