Fascinating question.
I mean, adjectives and nouns have declensions, and so do articles and pronouns. If an article is going to have a declension, better it have a declension that’s strongly associated with genders (since gender signalling is a core function of adjectives), than the third declension, which did not differentiate masculines and feminines. The first declension is feminine, with distinct-looking masculines as a late development in proto-Greek; the second declension is masculine/neuter, with feminines as an occasional exception. So they did correlate with gender strongly.
Of course, most pronouns share the alternation of first and second declension that adjectives have anyway; and the article originated as a pronoun.
There’s probably some Indo-European behind why so many pronouns decline that way, patterning with adjectives and indicating gender overtly; then again, the first declension was a late development in Indo-European.
Perfect? Maybe. But careful with your direction of causation. The first declension appeared probably a millennium before the articles did; the articles had the form they did because the declensions were a good match for gender, and that was something that happened in adjectives way beforehand.
Third declension adjectives do exist, and third declension nouns definitely exist; they don’t differentiate masculine and feminine, and there aren’t as many pronouns in the third declension. (Of course, τίς, τί ‘who’ is hardly an obscure pronoun.) By some criteria, I guess that makes them less perfect. By some, they’re rather more perfect…