Guilds were developed C. to protect the interests of the craftpersons.
Since they didn't have many opportunities at the time, they had to create some kind of a union where they could be given many chances and where their interests would be represented. Thus, guilds were founded.