Select groups to relate the node to directly in the node creation form
There is no module that offers this out of the box as far as I know. You'd need some custom programming. I don't know what exactly you need, but here's something that might help to get you started.

Let's assume you want to programmatically relate a node/content to one/multiple groups as soon as the node is created. You could use a hook hook_ENTITY_TYPE_insert() (hook replaced by your custom module's name and ENTITY_TYPE replaced by the entity type (e.g. node).

Here's an example for article nodes:

use Drupal\node\Entity\Node; 
use Drupal\group\Entity\Group;

/**
* Implements hook_ENTITY_TYPE_insert().
*/
function modulename_node_insert(Node $node) {
  if ($node-&gt;bundle() == 'article') {
    $pluginId = 'group_node:article';
    // Here create some logic to load/chose the group id's you want to 
    // add the content to
    // ... 
    foreach ($group_ids as $gid) {
      $group = Group::load($gid);
      $group-&gt;addContent($node, $pluginId);
    }
  }
}


This would automatically add the (article) nodes that are created to one or multiple groups. This is just a basic example of how to code the differnt parts. You can however make it as complex as you need. Hope this helps