I've tried using two TOC blocs from plugins and they were both very good and get improved when problems appear. They are: 1. The TOC block from Ultimate Addons for Gutenberg, 2. The TOC block from Kadence Blocks. They both have a lot of settings for colours, fonts and sizes. I'm currently using the Kadence TOC block after there was a bit of a hiccup with the UAG TOC block. I suspect UAG have made improvements by now so I must take another look at it. Both versions automatically insert anchors linked to headings and process editing of headings. More than one TOC can be entered in any post. You can set a TOC to work with H1, H2 and H5 say and another TOC to work with H3, H4 and H6 say. (Each heading can be turned on or off in each TOC.) Why would you want to do that? Well one might list sections in a document while the other lists pictures (by giving each picture a heading immediately before it using H4 say.) Another question is, "Where to insert a TOC?" Well I put them after the "Introduction". I start each post with an "Introduction" H2 heading followed by a few paragraphs. The first paragraph has to include the Focus Keyphrase for SEO reasons. This is why the TOC can't be at the beginning of the post. I think anyone wanting to put a TOC in core should look at the facilities and settings offered by TOCs in plugins, such as those I've mentioned, to get ideas about what can be done.