Why do we need a bootloader separate from our application program in microcontrollers?
A bootloader on a microcontroller is responsible for updating the main firmware over a communication channel other than the programming header.  This is useful for updating firmware in the field over BLE, UART, I2C, SD cards, USB, etc.  It would be extremely inconvenient to require customers to purchase programmers just to update the firmware on their devices.

The reason why the bootloader is kept separate is for reliability.  The bootloader and application code are placed in separate sections of flash, so that the application code can be erased and re-written by the bootloader without changing anything related to the bootloader code.

If the bootloader and application were kept together, then the bootloader code would need to be copied to RAM before it could run, since any firmware update would erase the bootloader code in flash.  If power were cut with the bootloader code in RAM and the flash erased, the device would be bricked.