There've been a couple posts (you can probably search for them) on how to make an OnLoad firing function that sets a variable, and then how to build a macro that toggles that variable. It probably wouldn't be too difficult, assuming you understand the basics of how this LUA code stuff works, to modify that code to toggle a variable when you click whatever button to summon your non-combat pet, and click it again to unsummon it.
This would not, of course, be actually checking for the condition of the pet being out. It'd just be in synch with that, assuming nothing got that out of synch (you'd have to make it reset after zoning -- not sure offhand if that counts as OnLoad or not).
I know this isn't an answer, but maybe it's a direction.