OK but it means we will need to remove the Tengri religion.
Don't remove it.
Instead you need to simplify your mess.
1. Animal is outside vicinity range - doesn't matter if still within borders or its traded from AI.
2. You can build animal related building, lets say National Breeder - not just for livestock but for all animals, that have map resource.
3. Animal Breeder gives animal, this means you can now safely lose access to animals from trade or you can lose access to tile with it (if animal here wasn't in vicinity).
There would be special autobuild building, that its only prereq would be: Animal Farm (Animal) [Needs animal X in vicinity] OR National X Breeder [If Animal is outside vicinity range, provides animal] OR Herd - X [Subdued animals can place that, provides animal].
It would be named Animal Supply Effect - Animal X, representing that you own those animals.
4. Now you can build Tamed Animal unit and place this animal within vicinity - would need Animal Supply Effect - Animal X.
5. Animal Tamer can place its animal type on map, now you can build Animal Farm somewhere else.
6. Building, that is responsible for training units or other stuff can use Animal Supply Effect - Animal X.
That is 1 - 5: Establishing your own source of animals.
6: Now can use animals
If animal is within vicinity, then you can build animal farm here.
You can build Tamed Animal to place critical animals like horses at cities, that produce military units.
Great Farmer is 50% way to tanks and other animal-less stuff of Modern and later Eras.
Its more useful for corporations, that use plants and animals than for getting animals.
Also its nice way to obtain plants, that you don't have but you are trading with AI, for example securing dye - manufactured resource.
Standard Ethanol in Industrial era can give you MASSIVE BOOST of
, if you place potatoes or something on every tile with farm.
Even without that you can place
giving plants and animals,
That is Great Farmer is Mid game - Medieval and can place any plants/animals, that you have (on your territory or importing).
Animal Tamer is Ancient. It can place single animal of its type where applicable.
There are following map resource land animals:
Beaver, Bison, Camel, Cow, Deer, Donkey, Elephants, Guinea Pigs, Horse, Kangaroo, Llama, Mammoth, Parrots, Pig, Poultry, Rabbit, Sea Lion and Seal, Sheep, Walrus.
Most of them should be easily breedable.
I'm not sure about Mammoth, Sea Lion&Seal and Walrus
This way you can avoid FreeBuilding tag bugs.
Essentially Tamed Animal and animal requiring buildings would require Animal Supply Effect - Animal X.
Tamed Animal can place animal of its type if applicable.
That is:
Player researches Equine Domestication.
Notices, that he doesn't have horses in empire, or at least not within vicinity range.
Then he imports them or builds improvement on Horse resource.
Now he can build National Breeder, he chooses most productive city for it, as he can't spread them until Specialization.
Autobuilding named Animal Supply Effect - Horse is built in city with National Breeder.
Now player can build Horse requiring buildings.
If horses were in vicinity, then player would build Horse Farm, and same autobuilding would be created.
Still he can build National Horse Breeder if horses were at new city. Autobuilding gets built in in this and that city.
Subdued animals can place Herd, and they also would create that autobuilding in this city.
Later at Specialization he can build Tamed Horse to spread them at other cities.
Way later at Agriculture Tools (Medieval) he can build Great Farmer so he doesn't have to build 10 types of Tamed Animals units (wasn't Great Farmer limited to one unit at once nationally?)
Autobuilding is here to compress X OR Y OR Z to one thing.
Unless GOM allows for:
(X OR Y OR Z) AND A AND B AND (C OR D) AND (E OR F)