I'm puzzling over this, too...don't know that I have any answers, but I can throw some additional information into the discussion.
The passage is from the beginning of the second book of the Nicomachean Ethics (Bekker page 1103a).
The complete sentence reads: τὰς δ᾽ ἀρετὰς λαμβάνομεν ἐνεργήσαντες πρότερον, ὥσπερ καὶ ἐπὶ τῶν ἄλλων τεχνῶν: ἃ γὰρ δεῖ μαθόντας ποιεῖν, ταῦτα ποιοῦντες μανθάνομεν, οἷον οἰκοδομοῦντες οἰκοδόμοι γίνονται καὶ κιθαρίζοντες κιθαρισταί
I looked this up in Perseus in the hopes there might be a commentary on the passage. I don't know if additional context would help. Rackham's English translation reads:
Moreover, the faculties given us by nature are bestowed on us first in a potential form; we exhibit their actual exercise afterwards. This is clearly so with our senses: we did not acquire the faculty of sight or hearing by repeatedly seeing or repeatedly listening, but the other way about—because we had the senses we began to use them, we did not get them by using them. The virtues on the other hand we acquire by first having actually practised them, just as we do the arts. We learn an art or craft by doing the things that we shall have to do when we have learnt it: for instance, men become builders by building houses, harpers by playing on the harp.
He adds the following note on this sentence:
Or possibly ‘For things that we have to learn to do [in contrast with things that we do by nature], we learn by doing them.’
So...there does seem to be some uncertainty here about the relationship of μαθόντας to the rest of the sentence.
Option 1: "...those things, which are necessary for us to do, when we have learned [the craft]..."
Option 2: this is the version we've been having trouble with, and while the translation makes a certain intuitive sense, I'm having trouble parsing it as well.
The only way I seem to be able to work it is to interpret ποιεῖν as dependent on μαθόντας rather than δεῖ, something like"It is necessary for us, who learn to do these things..."
This seems very elliptical to me, and I don't know if it's possible to use δεῖ this way without an infinitive, but I've seen stranger things in Greek.