Hierarchy lines (like we also have in the Outliner) make it easier to visually parse the hierarchy, and avoid confusion about nesting level. Especially when some items have icons and/or collapse chevrons and some not (thus different levels of visual indentation). They were planned for #93582 and #107881, also see https://code.blender.org/2023/05/the-next-big-step-grease-pencil-3-0/#layer-groups. The drawing is implemented as a general tree-view feature, so all tree-views with collapsable items (which excludes the spreadsheet data-set tree view) will get them without further setup.