Hiya Jonty!
So toolboxes are very extensible since their recent refactor, but flyouts are still not extensible :/ You could use a flyout button for this, but there's no way to make it look like an "x", or be rendered in the proper corner, etc.
Honestly I'm not even sure that this is possible if you were to fork and hack Blockly :/
But I also love this idea, so if you want to file a
feature request that'd be awesome!
Sorry I don't have a more helpful answer for you :/ If you have any other questions always feel free to ask!
--Beka