The metaphor of programmer-as-craftsman and the concept of apprenticeship are great up to a point ... and that point is where it gets medieval.
I don't think software development is a craft - I think it can and should be (and - in XP teams - is) an alloy of art, science and religion.
For models, I look first to the Renaissance, to people like Michelangelo, who studied anatomy as seriously as any practitioners of "scientific medicine" of the time, and to DaVinci, who studied physics equally seriously. They were both also brilliant artists.
The medieval role that comes closest to a model for me is not the craftsman but the monk - particularly the scribe whose faith in a divine perfection drives the work.
But the scribe is a soloist. And so were Michelangelo and DaVinci.
Renaissance artists who weren't simply soloists were businessmen. The master/journeyman/apprentice hierarchy in the art biz survives even now - e.g., Andy Warhol and his "factory".
What happens when software development organizations use the guild as a model? In two big "Agile" consultancies I know of and will not name here, the result is ... architects. Oh yes, they code. But they also do BDUF. And they radiate "authority". This doesn't meet my understanding of Agile.
XP is not a solo activity but a communal religious action with a particularly clear vision of the sacred. In OO we have an esthetically and logically balanced basis for design, still evolving. In XP, we have a concept of perfection - the sacred - that is dynamic and minimalist: the simplest system that does exactly what the customer wants, no more no less. (I'm using the term "sacred" here the way social anthropologists since Durkheim have used it - there's nothing intrinsically supernatural about it, except to the extent that symbols themselves are supernatural [for which I will make a case elsewhere].)
The closest modern analogy might be a Charismatic congregation (Catholic, Protestant or ...?) with a lay leader who is not a priest (architect), who has no special connection to the sacred. These groups are radically democratic.
What makes XP more than any of these models is the unification of art, religion, science and commerce.
It's the wisdom of a small crowd focused on the good, the true and the beautiful.