I have a custom page for image attachments in my theme. When I go to any page with image attachment, edit attachment description (the same as post content) and save the description there is attachment image appears before the attachment description.
I have solved this bug and want you to solve it in your plugin.
When page loads it there is script includes – wp-include/template-loader.php. On line 29 it removes ‘prepend_attachment’ filter which add attachment image before the description.
But when your plugin send AJAX request to plugin – template-loader.php script doesn’t include.
In my case I just added the same remove_filter to my theme setup action.
wp-include/template-loader.php, line 29: remove_filter('the_content', 'prepend_attachment');
core.php in your plugin, line 221: $result = @apply_filters( $filter, $result ); // TODO: remove, since additional arguments aren't passed
on this line the_content filter applies and prepend_attachment filter applies too by the_content filter.