The execution of the script goes (ideally) like this:
* dispatching
 -> action_something() method
   * which uses subs1, subs2, subs3
   * and sends to template.
Where do you see "a lot of calls to that"? The action_something() method is a single method (sometimes two), so after the call to getMembergroups(), it has the result, likely in $context. The template has $context.
I think in most cases the execution of the script with core files alone has a single call to getMembergroups().
With addons and integrated sites, it may have more calls for their own needs, but that's a good thing, not a bad thing. Sharing data through $context with external apps isn't cool, nor sharing internally for that matter. The API exists to be used.