The Torah says that Midyan was Avraham (Tzadik) and Keturah (Tzaddekes) son:
וַיֹּסֶף אַבְרָהָם וַיִּקַּח אִשָּׁה וּשְׁמָהּ קְטוּרָה׃ וַתֵּלֶד לוֹ אֶת־זִמְרָן וְאֶת־יָקְשָׁן וְאֶת־מְדָן וְאֶת־מִדְיָן וְאֶת־יִשְׁבָּק וְאֶת־שׁוּחַ׃
Abraham took another wife, whose name was Keturah. She bore him Zimran, Jokshan, Medan, Midian, Ishbak, and Shuah. (Gen 25.1)
Some 300 years later Moshe exterminates Midyan's nation for being particularly bad to the Israelites.
Was it the same Midyan (I don't see any other Midyan born in Bereshis) and if yes how did this nation come to be so bad it needed full extermination?