Fix auto identified headers when already auto-id'ed

If a header already has an auto-id, it would previously get renamed twice -- once as a bookmark and once as a header id. The result was that it would get a spurious integer counter at the end, and wouldn't be hidden in markdown output. This would only occur in pandoc-generated docx, but we mgiht want to go back and forth.

The meat of this change is checking whether we're in a header when we rename bookmarks. If we are, we don't rename or register, since that will happen to all headers later anyway.