Both Kaguya and Triple Eyed Madara solo The Sage.
Hagoromo NEEDED Hamura to defeat his mother. If he didn't need Hamura, why did Hamura even participate? It couldve just been SO6P vs Kaguya. Kishi introduced Hamura for a reason, to prove Kaguya is the strongest.
Madara is close to her power he had the strongest genjutsu in the series, also the Sage didn't have EMS or Sharingan reading capabilites. and 3 Rinnegan > 2 Rinnegan. Madara was only missing a tiny portion of each beast so it's negligible. Furthermore, the tailed beasts are much stronger when Madara had them compared to when the sage had them (remember how they were all baby animals?) Now they are full grown and since Madara had all the full grown Tailed beasts, he was stronger than the sage.