I’m pretty sure the Talmudic rule didn’t expect 12-14-year-old girls to be married off with anything resembling frequency. Betrothed to a boy of similar age as a pact between families, maybe, but not flatly married. A floor of 12 was likely acknowledging that having proper mental maturity before then just isn’t possible, no matter what her everyday behavior might evince (as in understanding ethics et al., thank you very much).
Keep in mind that the Talmud wants to fill in every corner case it comes across; certain passages trotted out as endorsement of paedophilia aren’t actually the case. The bit about a toddler still being deemed a virgin, for instance, was apparently a case of preceding child rape, and the rabbis determining that there was no way this should be held against her many-years-hence marriage prospects in any way. In at least its contemporary way, it looks to have been safeguarding the rape victim’s future, not the paedophile, whom I’ll trust got at least exile. (And hopefully I haven’t crosshaired myself with mistaken information or interpretation…)