Both that and the encourage home ownership theory seem unlikely when it comes to why it was deductible in the first place.
It became deductible in 1913, but simply because in 1913 all interest became deductible. The first $3k ($4k married) was excluded. Only the top 1% paid enough interest to take any deduction, and very little of that would have been mortgage interest because they usually bought their homes outright.
Wikipedia claims that the reason they made interest deductible on personal income taxes was that in a nation of small proprietors the line is fuzzy between personal and business expenses, and it was simpler to just make it all deductible instead of just trying to allow business interest to be deducted.
As for why credit card interest later became non-deductible, it is kind of the inverse of why mortgage interest is deductible. That is just as mortgage interest became deductible because all interest became deductible, credit card interest became non-deductible because almost all interest became non-deductible. The Reagan tax reforms took away almost all such deductions except the mortgage deduction.
As to why Congress decided to save the mortgage deduction when they were killing all the rest--I have no idea. That was in 1986, when a lot more than the top 1% were taking it, and most homes were bought using mortgages, so both the "encourage home ownership" theory and the "encourage more borrowing to please the banks" theories are plausible, at least.