Re: How to overwrite a function?
OK, I think I have a lead for you.
The function you want to replace may be groups_setup_nav() which is located in bp-groups.php
I believe this is the function that decides (among other things) what the default subnav display item is.
I would first edit groups_setup_nav() to see if it works the way you think it will. If so, then undo your edit, copy the function to bp-custom.php, and rename it my_groups_setup_nav, redo the edit, and then unregister/reregister the function by adding this code to bp-custom.php:
add_action( ‘bp_setup_nav’, ‘my_groups_setup_nav’ );
The remove_ and add_action SHOULD work but I may be wrong that you can simply drop the remove_action and add_action in bp-custom.php and expect it to work. This BP tutorial might explain the remove/add process better: https://codex.buddypress.org/how-to-guides/modifying-the-buddypress-admin-bar/