I'm tempted to apply the following patch, as this problem falls under the category of "inserting in an invisible region". I don't think it breaks any non-interactive call of org-insert-heading, but this needs further checking. Also, note that the problem occurs only when there is no blank line between the :END: and the following headline, so maybe the real fix has to be within org-insert-heading...