How to fix «Unable to send the cookie. Maximum number of cookies would be exceeded»

Looks like Magento 2 uses an obsoleted specification RFC 2109 for cookies limit.
The new specification is RFC 6265, and it allows at least 50 cookies per domain.

So the MAX_NUM_COOKIES limit can be safely increased up to 50.

Locate the line:

Replace it with the new one:

const MAX_NUM_COOKIES = 50;

See https://github.com/magento/magento2/issues/1500#issuecomment-156421883