ESP32 DAC cannot output zero volts
Do you have the pull-up enabled for the DAC output?
The DAC output pins on the ESP32 can be used either as a normal digital input/output with programmable pull-ups or pull-downs. If the pull-up is enabled it will put a small current into the output that will raise the minimum voltage slightly.
The DAC uses a resistor network and a activated pull-up will result in a small positive if it is enabled.
Also, even if the DAC outputs zero volts you cannot guarantee that the discharge current will be zero because of op-amp offset voltage.
The LM358 opamp has the possibility of having an offset voltage of up to 3mV depending upon the grade and manufacturer. It could be that you provide it with 0V but it interprets the voltage as being positive or negative up to 3mV.
One way to avoid this issue is to intentionally provide an offset of a few mV in the opposite direction that is larger than the possible offsets of the DAC and opamp. You can compensate for that offset in software although the amount of offset required will be only about 1 LSB of the DAC so will probably not be significant.
You can introduce this by adding a resistor of say 1kohm between the current sense resistor and the amplifier inverting input pin then add a resistor from the input pin to the +5V supply. 470k would inject about 10uA that would result in 10mV across the 1k resistor.
Then any input voltage less than 10mV from the DAC would give zero discharge current.
I would also put an attenuator on the DAC output (maybe after an opamp buffer) so the working voltage across the current sense resistor is say 0-1V rather than 0-3.3V as you have it. There would be less power in the sense resistor and it would work down to lower battery voltages and would provide better resolution at low currents.