Aside from the literal sense, this modern expression “the dog house” is used to mean that a person is undergoing punishment of some sort.
It is usually used to denote the treatment, mental or physical, meted out to a man by his spouse for some misdemeanor.
Probably the original allusion was to a “gay dog,” a man who, in his wife’s opinion, had been somewhat too gay and jovial, or perhaps had been roving too far from his own fireside.
And, just as the punishment for a roving dog is to be confined to his kennel, so the two-legged gay dog deserved similar treatment.