pull down to refresh

That is pretty funny.
There are lots of things that could be going on with unions/guilds. As you mention, they may have improved human capital through training (although evidence for that improving productivity is limited). They may offer beneficial selection, by not admitting low quality people into the labor market. They also can improve the bargaining power, shifting more of the economic surplus to labor. Those higher wages may also attract higher quality workers.
As with almost everything in the economy, the main problem is artificial restrictions on free association. If independent workers could freely compete with unionized, then the unions would have to sell employers on the merits mentioned above (other than bargaining power) and if they were sufficient, the unions would get the contract.