Animals Stacking in Stories
You may be thinking of the children’s book “Corduroy” by Don Freeman.
While it does not feature farm animals, it involves a stack of stuffed animals helping a teddy bear reach a high shelf: a giraffe, a hippo, and a penguin allow Corduroy to climb up and find his missing button.
If you remember more details about the animals or setting, I can help you identify the exact story you have in mind.