The text is a proverb suggesting that someone who wants to justify a wrongful action will first create a pretext for it. It does not play on the different meanings of a word or similar-sounding words for a humorous effect.
He that would hang his dog gives out first that he is mad .