My bootloader resides in the first lower flash pages. How do I avoid it to get destroyed and overwritten by the application?

To avoid the bootloader from getting destroyed and overwritten by the application, you have to protect the bootloader flash blocks. To protect, you have to specify the value as Protected in the Value column of the Protected regions group in the Component Inspector - Cpu tab of the CPU component properties, where you can protect 4 KByte regions, as the following figure shows:

Figure 1. Protecting Regions in the CPU Component

Protecting Regions in the CPU Component