I've been experiencing this for the past two years ever since I got my iMac 5K. Before that it never happened to me on my MacBook. It will happen when you least expect it and there's no specific way to recreate it because it's very random. It happens more and more often as time goes by though and it's very annoying. I've locked my toolbars thinking this would stop it but it doesn't. For me they don't completely disappear, instead they all compress into a one icon block on the upper left hand side of the screen. It has one icon only with the little double down arrows on the right of the icon. So what I've figured out is to grab the icon and pull it down to force the toolbar to redock and then they all come back but in jumbled order. Then after that I go into Preferences> Reset Options> Reset Toolbars> OK. VERY IMPORTANT...you have to first drag the icon to force the toolbars to redock. If you skip this first step and try to reset the toolbars this does not work. Because of this I stopped using any customized toolbars a long time ago. This is most definitely a bug and not user error. Hopefully this will be fixed someday :/