Note:
I do not want to force members of the group root, enter all parentgrpous, like this:

/* groups_join_group is called whenever someone joins a group in both BP 1.2 and 1.5.x */
add_action(‘groups_join_group’, ‘my_join_group_action’, 10, 2);

function my_join_group_action( $group_id, $user_id ) {

/* This part is critical – you must select ONLY the groups you want to START this chain
* This function will recurse up to the toplevel on its own, so if you have a parent group
* in the list, you will waste resources trying to join the same group multiple times
* as this function is called on each step up the tree
*/
/** Pick from a list of groups */
if( in_array( $group_id, ARRAY_OF_GROUPS_I_CARE_ABOUT ) ) {
/* — OR — */
/** Select groups by depth */
if( count( bp_group_hierarchy_get_parents() ) == DEPTH_OF_GROUP_I_CARE_ABOUT_EG_3 ) {
/* — OR ANYTHING ELSE YOU LIKE */

/* However you choose to select groups, once the group_id matched this part will
* walk up the tree, joining the user to each parent group along the way
*/