Historically, the numeral два
required a special dual number (два крыле, двѣ нозѣ), and the other numerals were usual female nouns, which governed their objects just like any other female noun would: пять монет / горсть монет, same likesimilar to пятёрка монет.
Later, when the dual number fell, its forms corresponding to два were rethought as sg. gen., and the words три and четыре accepted this paradigm too (because they were not of third declension, and were influenced by paradigm of demonstrative pronoun те in plural).