Come and hear: If a friend requires unloading, and an enemy loading. one’s [first] obligation is towards his enemy, in order to subdue his evil inclinations. Now if you should think that [relieving the suffering of an animal is Biblically [enjoined], [surely] the other is preferable! — Even so, [the motive] ‘in order to subdue his evil inclination’ is more compelling.
After a bit of googling, I don’t think it’s a quote by Maimonides.
The closest I could find is this passage of the Babilonian Talmud: