Let's start with this:
Most examples for context provider and plugins consuming context
values only operate on single values.
While that's true, recognize that the "single value" being provided is an object, not a primitive type. In the case of the Group context provider, that "single value" is an Entity object of type 'group'. The entity itself contains all the usual data - id, label, description, created date, author, base fields, etc. So it's wrong to think of it as one number only.
To provide an array of values, you need to return an object that represents a data structure instead of an Entity. The core Typed Data API defines a variety of datatypes, of which the Map type is probably the best for your purpose. Map holds a collection of values, similar to a familiar associative array in PHP.
So the outline of the solution is to create your own context provider by copying the existing Group context provider, modify your copy so that instead of creating an Entity context definition you create a Map context definition, then add the values you want to provide to your Map.
If you need more functionality, you can create your own datatype (I recommend subclassing Map for this) and provide an object of that datatype instead of an Entity or a Map.
You can find a short example of how to write your own Context Provider here:
https://www.drupal.org/docs/contributed-modules/rules-essentials/for-developers/providing-global-context-variables