You want a user to connect with all other users with the same gender? As long as you don't depend on the connections triggers you could probably just do that using a database query. Example as follows.
Code:
INSERT IGNORE INTO `#__comprofiler_members` ( `referenceid`, `memberid`, `accepted`, `pending`, `membersince` ) SELECT '[user_id]', `id`, 1, 0, NOW() FROM `#__comprofiler` WHERE `cb_gender` = '[cb_gender]';
INSERT IGNORE INTO `#__comprofiler_members` ( `referenceid`, `memberid`, `accepted`, `pending`, `membersince` ) SELECT `id`, '[user_id]', 1, 0, NOW() FROM `#__comprofiler` WHERE `cb_gender` = '[cb_gender]';
Believe that should establish a connection both ways between the user registering and other users with same gender. I didn't test it so be sure to test carefully and adjust as needed.