My experience has been that with any user input request, this is normal - the first cancel causes the popup to repeat, the second exits the program.
This makes sense to me - the first cancel could be a user mistake, so you would want to make sure the operator meant to stop.
After the second, it’s clear that the user doesn’t want to answer the question, and the program probably can’t reliably continue without that input.
I haven’t experimented, but I expect that you could evaluate the response & create a new popup to verify what the operator really wants to do, then react appropriately.
Edit:
Does anyone know if it’s possible for the program to see the “cancel” response, so it can react in a more graceful manner than just stopping the program?