You are right in your diagnosis, hard-coding the name is no solution, entries might be renamed, etc. I'll look into the problem and provide a patch.
A couple of other points that might be helpful.
1) I wondered, if I used the definition code for en:photo_form as a boilerplate and added some other custom fields, perhaps the code you previously wrote to support photo carousels might be leveraged here to populate the image selection dialog?
2) CKEditor version 4 does not need the JQuery adapter. It has its own support for in-line (i.e. inplace=true) editing without depending on Jquery, and it has its own support for creating dialog boxes without requiring Jquery-UI. I was therefore going to have a bash at converting the xowikiimage plugin and related ajax code to run on the back of a native CKEditor v4 dialog.
I am more than happy to put time towards anything I can helpfully do.
Regards & thanks,