Dogs were not always regarded so highly. Yes, they were a great help to early man (and remain so today), but they weren't elevated to the position of "man's best friend" until relatively recently.
I don't know how long ago the comparison was first made between someone low and a dog, but it must have been a long time ago. In The merchant of Venice (Act I, Scene III), Shylock states
You call me misbeliever, cut-throat dog,
And spit upon my Jewish gaberdine,
And all for use of that which is mine own.
Well then, it now appears you need my help...
And foot me as you spurn a stranger cur...
You call'd me dog; and for these courtesies
I'll lend you thus much moneys'?
Much earlier, in the Bible,
Then Abishai son of Zeruiah said to the king, “Why should this dead dog curse my lord the king? Let me go over and cut off his head.” (Samuel)
... it is a safeguard for you. Watch out for those dogs, those evildoers, those mutilators of the flesh. (Phillipians)
From the above, I would guess that as long as there were skulking dogs, there have been such comparisons made.