Chayei Sarah 24:19 shows that one is allowed to drink before he gives water to his animals.
And she finished giving him to drink, and she said, "I will also draw
for your camels, until they will have finished drinking."
Chayei Sarah 24:32 shows that Eliezer took care of the camels and fed them before he went into the house and allowed Laban to offer him food.
So the man came to the house and unmuzzled the camels, and he gave
straw and fodder to the camels and water to wash his feet and the feet
of the men who were with him.
Animals that feed themselves, such as range cattle, are not subject to this rule. All animals that depend on the master to feed them are subject to this rule.
As you cited the gemara and as we see in
Zoo Torah: Feeding Pets First
“I shall provide grass in your field for your animals, and you shall
eat and be satisfied.” (Deuteronomy 11:15)
“Rav Yehudah said in the name of Rav: It is forbidden for a person to
eat before he has fed his animal, as it [first] states, “I shall
provide grass in your field for your animals,” and afterwards it
states, “and you shall eat and be satisfied.” (Talmud, Berachos 40a)
Rabbi Slifkin continues with the sources cited in the footnotes.
The requirement to feed one’s animals first applies to all creatures
in a person’s possession. There are some authorities who rule that the
prohibition of causing pain to animals only applies to working
animals. But feeding animals is an obligation with all types of
animals when they are held in a person’s house and are dependent upon
him for food. This would apply to all forms of life, including birds
and fish.7
A person need only give his animals food first if they are actually
hungry. Thus, for example, if a person has a python that only eats
once a month, he need only offer it food once a month. Some also state
that the obligation is also not binding if the creatures have their
own means of obtaining food.8
In addition, some state that a person is only required to give his
animals food before eating if it is the ordinary time to feed the
animals.9
7 Rabbi Yaakov Emden, She’elas Yaavetz 1:17.
8 Rabbi Yaakov Emden, She’elas Yaavetz 1:17.
9 Hagahos Tiferes Yaakov to Tiferes Yisrael, Shabbos 16:13.
See discussion in Shatzman, Nefesh Kol Chai, p. 179.