This is documented by Apple, but I don’t recall where. Developers should expect the dialog, which is asynchronous.
There’s also the “TCCUtil Reset” command in Terminal, which avoids the need to change the bundle identifier.
Console and desktop apps don’t share the same security mechanisms. You may find informative to read that in this website: https://eclecticlight.co
(for instance, signing checks have similar differences).