One way to document a custom block, is to add a demo or alternative definition script to the definition window. The normal order is for the hat block + definition to be in front of the demo script. Sometimes though the scripts are automatically reordered in a reverse way:
The order the clean up blocks function places scripts in is determined by they're current position. If you place the example script above the hat block, the example script will be placed above the hat block. If you put the example script under the hat block, it will be placed under the definition.
Open the edit window for the custom block, and manually rearrange it such that the main script (with the hat block) comes first. Now save the change, re-open the edit window, and find that the order has been messed up.
And now I can't even fully reproduce it with the original project anymore - it appears to be what physicians call vague symptoms.