I was deploying a Cloud Management Gateway on a customer site recently and encountered this problem. This was a PKI deployment so I was adding internal root and intermediate certificates in the Settings page of the CMG wizard.
I tried to satisfy the customer requirements but I was unable to add a third root certificate and received this error:
"You can only add two trusted root CAs and four intermediate CAs".
I found that this was a limitation with CMG in ConfigMgr version 1902. This limit has been removed from version 1906 and later.
The solution was obvious - upgrade the site to a later version.
I hope this helps. Until next time...…...