Customer/EventListener/CustomerGroupListener.php
protected function fixDefault(CustomerGroupInterface $customerGroup)
    {
        if (!$this->persistenceHelper->isChanged($customerGroup, ['default'])) {
            return;
        }

        if ($customerGroup->isDefault()) {
            try {
                $previousGroup = $this->customerGroupRepository->findDefault();
            } catch (RuntimeException $e) {
                return;
            }

            if ($previousGroup === $customerGroup) {
                return;
            }

            $previousGroup->setDefault(false);

            $this->persistenceHelper->persistAndRecompute($previousGroup, false);
        }
    }
protected function fixDefault(CustomerGroupInterface $customerGroup)
    {
        if (!$this->persistenceHelper->isChanged($customerGroup, ['default'])) {
            return;
        }

        if ($customerGroup->isDefault()) {
            try {
                $previousGroup = $this->customerGroupRepository->findDefault();
            } catch (RuntimeException $e) {
                return;
            }

            if ($previousGroup === $customerGroup) {
                return;
            }

            $previousGroup->setDefault(false);

            $this->persistenceHelper->persistAndRecompute($previousGroup, false);
        }
    }
Fixes the default customer group.

@param CustomerGroupInterface $customerGroup