That solution should work for brawlers as long as it does something else if activity gets too low - otherwise the concern of hitting 0s still applies. Since you're already modifying collision flags could you consider the brawler an obstacle so that your paths automatically go around them?
If you're talking about a solution for the running back and forth - pick one portal, and stick to it until it dies. AKA never look for a new portal to go to if the previously selected one is still around.
Regarding this:
I'm a little confused because I didn't try out portal hunter or give feedback on that mode. I would expect that running around should be normal behavior in that mode though. In any case, the bot should ALWAYS prioritize staying active over anything else. Dying, selected mode, prayers, potions, whatever, is all less important. It's a bit messy but the easiest way to implement it would be to put something at the top of your logic (once youre in the pest control game) that checks activity, and if its low, get the nearest low-defense npc and hit it. I can't really speak to mode switching since I'm not intimately familiar with what each one does, I only know the broad strokes detailed by your UI.
Will give it another shot when update's out