The node you are looking for is at Texinfo::Convert::Utils $heading_element = find_root_command_next_heading_command($element, $expanded_format_raw, $do_not_ignore_contents, $do_not_ignore_index_entries).