If this statement is true then why do we see sometimes a really good person has been paired up (married) to a really bad person?
You cannot take one verse of the Quran in isolation and derive a ruling from it. The fundamental rule in understanding Quran is
القرآن یفسّر بعضه بعضاً
[Often one part of Quran is explained by another part of it]
Allah sets forth, for an example to the Unbelievers, the wife of Noah and the wife of Lut: they were (respectively) under two of our righteous servants, but they were false to their (husbands), and they profited nothing before Allah on their account, but were told: "Enter ye the Fire along with (others) that enter!" (10)
How can we take "good women for good men and so on," in the literal sense when Allah (swt) Himself sets forth examples of odd pairs?
If you search the Tafasir, most exegetes don't even translate it as "women for men," but rather "bad talk."
الكلمات الخبيثات من القول للخبيثين من الرجال
This is in context of the false accusations against Ayesha (ra).
Some others who have interpreted it as "women for men," also qualify it like
وما ذلك إلا لإِظهار منصب الرسول صلى الله عليه وسلم وإعلاء منزلته
That is to say that the verse does not set a rule but it is meant to vindicate Ayesha (ra) and elevate the status of Prophet Muhammad (puh).
Lastly, there is also an opinion that the verse is related to
ٱلزَّانِي لاَ يَنكِحُ إِلاَّ زَانِيَةً (this itself is not understood as a rule)
and in this case one would say that "bad" (Khabith) means adulterer or adulteress and not just any conceivable mismatch of piety between the spouses.