Leah was hated — or unloved, depending on the translation, but the Hebrew is harsh — and God saw it (Genesis 29:31). This is where Aggadat Bereshit begins: with the divine attention settling on the most rejected figure in the room. The psalm that frames it is equally clear: "The Lord upholds all who fall and raises up all who are bowed down" (Psalm 145:14).
The midrash draws a contrast with how wealthy humans operate. A powerful person loves someone when they are prosperous and abandons them when they lower their hand to the poor. The powerful are attracted to the elevated and repelled by the diminished. God works in reverse: when He sees someone bowing down, lowering their hand, He extends His hand and lifts them up. Leah's unloved state was the precise condition that attracted divine attention.
The rabbis were making a point about how God distributes blessing. Rachel was the beloved wife — and she was barren for years. Leah was the unloved one — and she bore six sons. The apparent unfairness resolves, for the rabbis, into a divine compensation: God balances what humans leave unbalanced. He sees what humans fail to see. He honors what humans dishonor. And from Leah's dishonored womb came Judah, from whom came David, from whom came the messianic line — the most consequential womb in the story of Israel, belonging to the wife nobody wanted.