Identifying first and last instance of shortcode in post

Basically, nested shortcodes should not be used. As you say it ends as being too complex for an author to write one and therefor it will be too complex to understand and modify.

A better approach to such things is either insert a menu with a shortcode, or generate the accordion dynamically based on a specific HTML element (h2 for example)