The origin of this proverb has no exact scientific basis, but is more based on people's impressions and preferences for cats and dogs. Cats are usually considered as representatives of flexibility, independence and intelligence, and their behaviors often make people feel mysterious and interesting. Dogs are considered as representatives of loyalty, kindness and hard work. They are loyal to their masters and good at protecting their families.
So people like to associate cats with wealth and think that cats bring good luck and wealth. On the other hand, dogs are considered as a symbol of wealth and happiness.
However, this is only a traditional concept and statement with no scientific basis. In real life, wealth and happiness are determined by personal efforts, opportunities, environment and many other factors, and will not be directly brought about by raising cats and dogs.