/* stop watchdog */
WDTCSR |= _BV(WDCE) | _BV(WDE);
I think that needs to be just an "=" rather than an "|="
This is the "magic" "I'm going to change the WD config" value, and if WDTCSR had any value other than 0 before you run it the value won't be right.
is it possible to get a condition, where the watchdog reset and an external reset are both true?
I don't think so.
Do you ever turn the watchdog on?
You don't have any code at the end of main() to stop the AVR. Depending on compile switches and fuse settings, that means that main with return, and go off and do SOMETHING. Perhaps run off into random memory. Perhaps restart. Perhaps spin loop until reset by watchdog or some other mechanism.
The way optiboot works is that any reset condition OTHER than an "external reset" causes the bootloader to turn off the watchdog and start the app immediately. Otherwise the watchdog is turned ON and the bootloader starts looking for commands. If no commands are found by the time the watchdog triggers, the WD resets the CPU, that's a reason other than external reset, and the app starts...