Yes, any new firmware will overwrite the previous firmware.
The reason why the setting persists a firmware update is that the APN is written by the code into the cellular modem module and a mere reset does not power down the modem, hence the setting persists. But once you de-power the modem that setting will be gone and your code has to ensure that the modem gets "programmed" correctly again.
Yes that is possible via the respective AT
commands of the modem and Cellular.command()
I just don't know the exact command off the top of my head.
Another way is shown in this thread (hope this still works)
[Electron] retrieve IMEI and ICCID - #2 by MrZANE
This tutorial is also worth a ready
Electron 3rd-party SIM tips