Before you intersect with the user's groups, you need to do a prior intersection of the user's groups with the groups that have view_form permission.  You can use this code to get the groups that have view form permission:

$groupsThatCanView = $gperm_handler->getGroupIds("view_form", $form_id, self::$formulize_module_id);

Then, after you intersect that array with the $groups, then you intersect the result of that with $owner_groups, and then if there's anything left, ie: the intersect hasn't resulted in an empty array, then the user can edit this particular entry in virtue of their update_group_entries permission.