You've definitely found a bug with Blockly. The problem is a chicken and egg one:
- Blockly.inject(...) will create the toolbox button and in doing so, maps the button's callback to one that's registered on the workspace. If the callback isn't registered, the button doesn't get associated with the callback.
- However, you can't actually register a callback on the workspace until after Blockly.inject(...) completes.
The reason this isn't a problem with categories is because the toolbox button isn't created until later, when the category is actually shown.
-----
The simple workaround for now is to call the following after registerButtonCallback(...):
workspace.updateToolbox(document.getElementById('toolbox'));
We will file a bug to fix this though, so you don't have to do this in the future.