This roughly matches the behavior when editing this value via the buttons. Part of D10144
eevee_cryptomatte_shading_group_create