This is where you’re getting tripped up I think. A program that makes a decision is executing a series of equations and performing an action based on the answer. There is no reason why a mechanism couldn’t be designed to perform the exact same calculation and take the exact same action based on the answer. The reason that it’s not done normally in real life is complexity, size, and efficiency.
Check out this very cool machine that uses several “binary mechanical computers.” These computers are programmed by placing pins in different locations, but they are computers none the less. Their final machine will use sensors to synchronize the clock with the rising sun through the use of shape-memory alloy wire and a very unique lens.