Unravelling the progenitors of merging black hole binaries