Bootloader on Atmega328p overwrites whenever it gets programmed
Almost certainly your fuses are wrong. The fuses tells it whether or not to run the bootloader. With an empty PROGMEM (ie. no sketch) the processor probably skips over all the 0xFF bytes until it hits the bootloader. Once you have a sketch there it will run the sketch.

On my Uno (which is an Atmega328P) running at 16 MHz from a crystal, my fuses are:

Low = FF High = DE Ext = FD Lock = EF 


I suggest you visit http://www.engbedded.com/fusecalc to work out fuse settings.

You want the BOOTRST fuse set (that is, the high fuse should be 0xDE or something with the low-order bit clear). On the AVR chips, having a bit clear (0) means the fuse is set.

I have a bootloader programmer sketch which not only puts the bootloader there, it sets the correct fuse bit.

I also have a chip detector sketch which will tell you the current fuse settings.