I can't help feeling that you are confusing yourself.
Yes if it is just on discharge then there will be a volt drop from the internal resistance. If it has been on charge then this drop will also drain the surface charge and as well as the instantaneous drop there will be a drop in a few hundred ms due to removal of surface charge.
You need to get the digital boys to sort your programming problem, but the digital solution has ultimately to be the same as analogue.
The thing you need to monitor is battery voltage, when this changes for whatever reason you need to alter pwm so as to correct the change in voltage. If volts change instantly you need an instant change in pwm. If volts change slowly you need a slow change in pwm.
As long as you can sort the mess out in less than a second then there will be no problem. If you are too slow then the volts may go out of limit long enough to cause other problems. Doing this with analogue methods you have to maintain stability and there are tricks to keep thing stable ( Nyquist, Bode and more often just experience and good luck).
I am sure there are the digital equivalents of filters and time constants and methods of maintaining stability but they are beyond me, but processors surely are so fast that this is not a big issue. You must surely use volts as your basis and not worry about what volts do when you change pwm.
Flux