Force MacBook to drain the battery while connected to charger
Short answer

To the best of my knowledge there's no consumer software capable of doing this.

Long answer

Using software to disable the power input until your MBP is discharged to a certain level wouldn't actually achieve your ultimate goal (i.e. avoiding your external monitor from being temporarily disconnected). 

That's because disabling the AC power input (or more specifically, switching it from AC to DC) is exactly what's causing your external monitor to behave in this way, and there's no way for the hardware to discern why the AC power input is gone. In other words, it's not capable of telling the difference between an AC source being switched off, a power lead being unplugged, or some software just disabling the AC power input.

The only other way to try to achieve this is to get your MacBook Pro to use more power than what the charger is supplying for a period of time. While that's theoretically possible, in practice it's just not going to happen without something that will also act to override the System Management Controller (SMC). 

To explain that a little further, to get your MBP to try and use more power than is being supplied would involve stressing out the hardware, at which point the SMC kicks in to protect it, so any software would need to try and bypass the SMC as well. While it is possible to bypass some functions of the SMC, I really wouldn't recommend it, and in this case it's likely to cause much greater long-term problems than a swollen battery or a short-term problem like a disconnected external screen.