Islam is a mercy not only for all humans but it extended its mercy to all creatures as well. Almighty Allah says: “We sent thee not save as a mercy for the beings.” (Al-Anbiya’: 107)
Being a mercy for all creatures, the Prophet of Islam (the religion of mercy) has shown us through his commandments and teachings, how to tend and care for these creatures. Thus, he said, “The merciful are shown mercy by the All-Merciful. Show mercy to those on earth, and He Who is in heaven will show mercy unto you.”
Like all animals, dogs are to be treated with mercy. Islam far exceeds many systems and ideologies in declaring that it is a sin for a man to torture any animal including dogs.
On the other hand, Islam commends and praises good treatment of animals and dogs are not excluded.
The Prophet, peace and blessings be upon him, related to his Companions the story of a man who found a dog panting out of thirst. The man went down into a well, filled his shoes with water and offered it to the dog to quench its thirsty. The Prophet, peace and blessings be upon him, said: “Then Allah was grateful to him and forgave him his sins.” The Companions asked, “O Messenger of Allah! Is there a reward for us with relation to animals?” He replied, “There is a reward with (relation to) every living creature.”
As for the juristic issues you have raised, Islam does not allow keeping a dog at home for fun. But it allows keeping a dog in some other circumstances such as keeping a dog for watching or hunting.
As for the impurities of dogs, it shall be clarified within its proper context. Islam cares for the healthy atmosphere for all beings, humans, animals, etc. Therefore, when the interaction with some animals may cause healthy risks and harms, Islam does not encourage this interaction for protecting humans, animals, the environment, etc.
Here, it is noteworthy that what a man should avoid is coming in touch with dogs’ saliva and excretion according to some Muslim scholars. As for the dog’s fur or outer body, it is pure according to other Muslim scholars. All in all, Islam pays due attention to the well-being of humans, animals, the environment, etc.