Refactor: scheduler: best practices for get_containers_or_children()
Rename get_containers_or_children() to get_instance_list() for clarity,
add a doxygen block, and improve formatting.
Also, add a complementary free_instance_list() to make the callers easier to
follow.