See my comment in https://github.com/facebook/react/pull/11291#issuecomment-338974574.
I verified https://github.com/facebook/react/pull/11291 introduced this regression.
prodInvariant = path.node.arguments[1];
            } else {
              prodInvariant = t.callExpression(
                localInvariantId,
                [t.stringLiteral(prodErrorId)].concat(node.arguments.slice(2))
              );
            }
            prodInvariant[SEEN_SYMBOL] = true;
            path.replaceWith(
              t.ifStatement(
                t.unaryExpression('!', condition),
                t.blockStatement([
                  t.ifStatement(
                    DEV_EXPRESSION,
                    t.blockStatement([t.expressionStatement(devInvariant)]),
                    t.blockStatement([t.expressionStatement(prodInvariant)])
                  ),
                ])
              )
            );
          }
        },
      },
    },
  };
};