Hi @green_sparrow
The information that you provided was very illuminating. And poor @Nikolas got missed in favour of my double mention.
In the video, I saw you type “Test 1” followed by shift-home to select the typed text, then press the Heading 1 format button on the toolbar.
There-in lies the problem; your selection did not include the " ¶ " character (that character is called a ‘pilcrow’; I learnt something today).
When the pilcrow is selected, the style change applies to the whole paragraph, not just to the text. So while it looked like a heading, in fact it was only the text had the same character format as a heading, but not the functional formatting of a heading.
So, when you select some text to become a heading, select the whole paragraph, including the pilcrow, even if it is not displayed.

You can see the selection includes a hidden character; the undisplayed pilcrow, or ‘end of paragraph marker’.
If you are going to select the paragraph like you did in the video, the easiest may be to tap “Home” to bring the cursor to the beginning of the line, and then tapping “shift-End”. Triple-clicking in the gutter to the left of the paragraph should also do the same job.
Once selected, tap your heading style choice, and done.
A common convention is, at the beginning of a line, tap the heading style button, type the heading text, and when you tap the ‘Return’ key, the following paragraph is set to ‘Normal’. That avoids the selection process in setting styles, but the important thing is to select the whole paragraph when going back over existing text.
Only whole paragraphs marked, and styled, as a heading, are recognised as a heading. And will appear in the ToC, and the aforementioned Headings panel.
Does that make sense?