If you want a building for generating power, you might want to consider a treadwheel. Historically, it resembled a waterwheel and would have a person or animal walking inside of it to generate force.
I think this is a great idea, and while I don't know much about DFHack I think it might be possible to create a workshop that generates power with either a dwarf or a sufficiently large animal, I think it would just be a modification to the dfhack plugin that makes the steam engine generate power:
1 tile workshop.
Reaction A: Uses a dwarf & trains pump operating skill & generates 20 power.
Reaction B: Checks for an animal on the workshop's tile or the 8 tiles surrounding it, if it finds one checks it's size, and if it's bigger than a dwarf the machine runs for a month without interruption & generates 20 power.
So you could build the workshop on or next to a patch of grass, create a 3x3 pasture around it and put in a horse or donkey or ox. Even if you put it on repeat you'd need a dwarf to come by every so often to restart the reaction (check on the animal, refill it's feed bag, clean up the manure, etc.). Maybe you could even code it so that it wont work with starving animals, so if you build the workshop on a grassless floor you'll get a job cancellation notice before the animals start to die, and then you could manually rotate in full animals from your regular pastures and let the starving ones eat.