This was identified by Esri support as a bug: BUG-000089550
The initial workaround was to manually remove the reference overlay from the map's layer list the first time a new map is selected from the basemap gallery widget. However, since my application added the basemap through a configuration file, I couldn't always be sure a basemap with a reference layer would be used in the map construction.
Initially, support tried to use the map property basemapLayerIds, but this only works on the first change of the basemap. The property isn't changed when the basemap changes. Instead, the workaround uses the map's load event.
map.on("load", function(){
console.log(map);
var basemaps = map.basemapLayerIds;
setTimeout(function() {
for(var index = 0; index < basemaps.length; index++) {
var layer = map.getLayer(basemaps[index]);
layer._basemapGalleryLayerType = "basemap";
console.log(layer);
}
}, 2000);
});