The word evus (translated here as "crib") is not the place where the beast feeds but the threshing floor, where the grain is threshed ... the text does not mean that the ass knows its eating place but rather its place of work. The ass realizes that it has to work and stamp the corn at the threshing floor, since the work brings it reward in the shape of food, as it is stated in Scripture (Dt. 25:4): "Thou shalt not muzzle as ox whilst it is threshing."
Both the ox and the ass work for their masters in expectation of reward and realize that their work is for their own good, whereas Israel does not know or realize that the service of God and the walking in His ways is their life and the recipe of success.
Samuel David Luzzato (quoted from and translated in Leibowitz' Studies in Devarim)
... [R’ Yehoshua ben Qorchah asks], “Who was created for the sake of whom (mi nivra’ bish’vil mi)? Was earth (arets) created for the sake of a [human] generation, or a generation created for the sake of the arets?” ... R’ B’rakhyah said in the name of R’ Shimon ben Lakish: Whatever the Holy One created in the human, He created in the earth as a model for him (l’dugma lo). A person (adam) has a head and so does the earth, as it is said, “and the head of the dirt/ `afar of the world/teivel” [Pr 8:26]. A person has eyes and so does the earth, as it is said, “And they will cover the eye of the earth” [Ex 10:5]
Kohelet Rabbah 1:4:5