What happens to the battery during bootloader/recovery?
Charging control is done via hardware to prevent ruining the battery in case of software errors. That is why (most?) devices charge even when powered off. The status display that is then shown is just a "minimal OS" that queries the current status from the battery charger hardware.