Rav Hirsch says that Beshalach 17:1
The entire community of the children of Israel journeyed from the
desert of Sin to their travels by the mandate of the Lord. They
encamped in Rephidim, and there was no water for the people to drink.
They were not yet without water, but they looked at the country, and
saw that there was not there sufficient water for such a number of
people, and so, that they would be short of water.
As a result:
וַיָּ֤רֶב הָעָם֙ עִם־משֶׁ֔ה וַיֹּ֣אמְר֔וּ תְּנוּ־לָ֥נוּ מַ֖יִם
וְנִשְׁתֶּ֑ה וַיֹּ֤אמֶר לָהֶם֙ משֶׁ֔ה מַה־תְּרִיבוּן֙ עִמָּדִ֔י
Rav Hirsch points out the difference in language.
וירב is not תלונה as ויללן in v. 3 (from the meaning of לון) to mean
seeking relief from some privation or distress that one is beginning
to feel, but וירב is one has a right, as in the dispute over the wells
(Genesis XXVI,20). Here they wechiefley used for establishing a
supposed or real claim to something to which re not yet making any
reproaches, did not refer to their requirements, but, as a justified
claim, demanded water. Where we camp, there must be water.
Rav Hirsch points out that this was a manufactured complaint which led to the punishment because, while if Moshe had led them there they would have been justified, since Hashem brought them, the complaint was not justified.
The people thirsted there for water, and the people complained against
Moses, and they said, Why have you brought us up from Egypt to make me
and my children and my livestock die of thirst?.
Now that they actually felt thirst**, they panicked and thought that they were actually being denied water. Rav Hirsch points out that had they not complained, they would have gotten to Choraiv in one stage and would have been given the well. Instead, the complaints caused a delay and the feelings of thirst, and the water was at Choraiv anyway.
My own idea is from the way Rav Hirsch explains the difference in terms in the two verses.
They added the animals because they thought (as a result of feeling thirst) that they needed to bring up innocent animals as part of the complaint in order to get water.