When you do have a pet, the first press will target and dismiss it, while the following press will cast again (and your now uncontrolled pet is already targeted from the previous macro use), making it useful to re-control a minion. This macro will cast when you don’t currently have a pet.
Hybrid Macro for and Dismissing Pet: #showtooltip Control Undead Blood can make use of a few macros and addons, in particular, to streamline certain actions.