Chargebacks are supposed to be used when you made a good faith attempt to try to resolve it with the company, but are unable to. The customer representative making that mistake counts as the company failing to resolve the issue in a satisfying manner. This qualifies as a legitimate reason to file the chargeback.
There is no reason why the bank would cancel your card for submitting a chargeback when the merchant fails to resolve an issue in a satisfying manner after you made a good faith attempt to do so; it's literally what it is for. Furthermore, the bank would probably make more money from you keeping the card than closing your card. I know mine definitely does from how much I use it.
It doesn't cost the costumer any money to file; the fees are paid by the merchant, in this case Grubhub. Whenever a chargeback is filed, the merchant (Grubhub) has to pay a chargeback fee, typically ranging from $20 to $100. So already getting chargeback claims is a bad thing for grubhub, and they would likely want to avoid getting them in the first place; thus if you mention to Grubhub that you are considering a chargeback, it could increase the chance of Grubhub just refunding you rather than dealing with the chargeback, especially if multiple people are suggesting that they are considering filing a chargeback at the same time.
Furthermore, I would not be so sure that the bank would quickly dismiss this chargeback reason; it is clear that Grubhub violated its own terms and condition for the promo as it was clearly not first come first serve as stated in their terms and conditions. Again people who ordered before me did not get the code while I did.
So I do recommend that anyone who got an unsatisfactory response from Grubhub, such as refusing to refund you when you ask for it, to respond to Grubhub that you are considering filing a chargeback. The cost of just dealing with the chargeback can be more than just refunding you.