Ok, so here: https://github.com/Wikia/app/blob/VID-1308/extensions/VisualEditor/wikia/modules/ve/ce/ve.ce.WikiaMediaCaptionNode.js#L83 detach is called before parent onSplice is called in order to allow that onSplice (one in ve.ce.BranchNode) to work correctly.
If you remove detach does anything break?
Btw. I would be happy to look myself into this if you prefer - but I won't be able to do it today.