Bear with me, I truthfully have no idea how a game works coding wise, but judging by what I've seen, this shouldn't be impossible.
I've heard of people wanting to make ranches to keep their animals out of the hallways. But right now, as the animals attempt to path-find, it slows the game to a crawl. Cages and restraints, however, have a tendency to randomly make the animals stop breeding.
What I was thinking, is to dig a room, and then place something suitable (I was thinking a feeding trough) in it to zone a room off of. Assign animals to it like you would a cage, and then they will freely wander in only the area marked out by the 'ranch' room's borders.
Of course, they'd leave if, say, an undead elephant wandered in the middle of the group and began a massive massacre, but I'm assuming if they were inside that wouldn't happen as often.
Do tame animals actively eat? I've never noticed, but maybe they're assumed to just find their own food. If so, then by keeping, say, a herbivore (like a horse, mule, or cow) in a stone room where no grass grows would bring up the oppurtunity to make hay and give it to them, while carnivores (dogs or cats) would need similar food made of meat (or maybe just the meat itself.) That could give more use for the Animal Caretaker skill?
Feel free to tear my ideas apart, tell me how this could never work, call me names for thinking of it, ect. Just try to keep it a tad civil? No death threats, please!