Surrounding HTML Heading Content with Anchor Tag?

I think you could accomplish this with a custom shortcode.

You might have parameters called level and text, then the template would contain that full desired html example you provided, but substituting in the header number and content text where appropriate. You’d call “anchorize” on the header text to get the link and ID values.