I oversimplified a little, of course. Yes, some code to initiate programming condition either on reset or, for example, on interrupt from one of no longer used jtag pins. So, you are right, it is not THAT simple.
But I am not talking about writing my own bootloader, I do not have required skills...