I'm not sure I've ever seen anything engineered that is perfect, have you? what even is "perfect"? seems like an unrealistic standard and not the goal at all of any engineered system (civil, mechanical, electronic), I don't think that a good definition of "bad" is everything less than "perfect". I have seen software the fulfills the necessary criteria, especially in the world of control of machines, eg, engine control, industrial control systems, etc. Many things get built that work within their "engineering" criteria. I have one particular software application on a microcontroller that performs various functions and control, I've only ever deployed 1 version on thousands and thousands of devices, it has worked for a decade so far. It went through rigorous review and testing before being released.
if you don't change the inputs or any other variables, it is different from a program deployed in the wild... but yeah not very many things are perfect (even the sun will die one day).
It is deployed in the wild. But what you are describing is essentially engineering, being in control of your variables is key. Engineering is all about understanding what the variables are, what tolerances you need and building to those criteria. Pretty much anything engineered is on wobbly ground when it gets inputs/conditions unanticipated. Part of that is being clever about when things are in uncontrolled environments to find a way to sandbox things into a controlled environment. Much like the software world, a simple thing is put it in a "container"/box/case and limit the "input" to the underlying system.