In addition to normal behaviour, all Inserters take fuel from entities containing a burner when they or their drop target have no fuel left.
Small changes concerning balance, gameplay, or graphics.
Augmented or new ways of transporting materials - belts, inserters, pipes!
I took a quick look at your code. And i find it quite complexe. Why don't you just use the allow_burner_leech lua proportie and add it to inserter? would it not solve all UPS issue ?
That property is set to make the inserters leech fuel for themselves. But extra logic is needed to leech fuel for their target.