it is not necessarily that depsgraph is built from G.bmain. This will solve issue reported in T51782.