Well, yes. A macro could be written. Has one been written? Not that anyone who posts to these (or similar) forums regularly knows about. I've been following them regularly for more than ten years. If such a solution had been posted,
You certainly are not the first person who has asked how to do it, and been told that Word does not provide a way.
I would have seen it and referred to it in my page on
Generating a Table of Contents - Complex Documents.
You are talking about a substantial amount of work for a very limited application. Are you willing to do the work or pay to have it done?
If you want to do it yourself and share the result, someone will probably be willing to work with you on it.
The thing is, the TOC field works very well for virtually all of the uses asked of it. Replicating that function, using vba that gives a different result is not a minor thing.