Basically. Madara collected the "parts" of Hagoromo's Chakra. Ashura and Indra aren't normal offspring; their chakra is literally the divided chakra of Hagoromo. Madara combined those; once Madara was no longer in control of that chakra (due to legs being severed / his will being overtaken), Hagoromo's traveling chakra spirit was able to use Madara's legs as a "tether" to the living world.
It's the same thing Obito was able to do when he latched on to his shouldering ashes in the Kaguya fight, which still had some of his chakra / life force in them due to receiving so much chakra from Naruto. Obito's spirit was able to latch on to that living piece of himself.
I'm not sure if Hashirama coming in contact with the Juubidara legs had anything to do with summoning Hagoromo, or if it was pure coincidence. Maybe the Ashura chakra alerted Hagoromo.