Oh, so that's what stops it from being overwritten! What does it actually do though?
I was wondering about that. If I were to compile a program for the atmega328 with AVR-GCC, then upload it to the board using WINAVR and an ISP, would the bootloader be erased then?
Yes, because the IDE uses avrdude to do exactly that. It uploads a .hex file using the bootloader, if requested.