The bug is related to Admin Product Page is broken: «Element with ID ‘catalog.product.edit.tab.downloadable.links’ already exists»
See the code:
$group->getAttributeGroupCode() can return null.
I opened the eav_attribute_group table and saw that some records has null in attribute_group_code column:
SELECT * FROM `eav_attribute_group` WHERE attribute_set_id IN (
SELECT attribute_set_id FROM eav_attribute_set WHERE entity_type_id =4
)
This is because of the incorrect attribute group identifier generation algorithm:
Attribute group code generation algorithm is incorrect because it can return null for an attribute group with non-Latin name
$group->getAttributeGroupCode() becomes the tab identifier. So we have a tab with null identifier.
$childTab->getParentTab() === $parentTab->getId() compares null with null and returns true.