"Role" is a homophone of "roll". A roll is a piece of bread. A role is a person's part in a play, or scenario, or an expected behavior pattern. A role reversal is when someone adopts a role that is the reverse of what they normally do. A baker typically takes the role of selling a bun, not receiving a bun from someone else. So, the bakers experienced a "role reversal" when they received a bun from someone else, except "role" was replaced with "roll" because roll means bread, and bakers are the subject in the joke. 
When two bakers traded buns they had a roll reversal .