li-ion pack charging with buck boost xl6009
This is not how I would do this, have a look at this forum, there someone posted a schematic of an adjustable DCDC downconverter with current limiting. Note how it uses an opamp to amplify the voltage across a current shunt resistor, the output of the opamp then influences the feedback input of the Switching regulator (in this case the LM2596) via a diode.

When the current becomes too large, the opamp output voltage increases, via the diode the FB input of the LM2596 is pulled up, the LM2596 then lowers the output voltage. This scheme will also work with an XL6009.