Making a small 'optimization' which instead actually leads to disaster

Solution 1:

Penny wise, but pound foolish

It is perhaps not a perfect fit, but the basic idea here is that someone is so committed to saving whatever money they can that they don't make choices which are more efficent in the long run.

It is less common (but not unheard of) to apply this phrase to non-monetary situations by analogy - like, "You shouldn't have drilled that hole in the wall. You are being penny wise but pound foolish."

Solution 2:

You should let well enough alone, defined by Merriam Webster as:

to stop changing something that is already good enough •I never did learn to let well enough alone.

Also, leave well enough alone. The Free Dictionary says:

The idea behind this expression dates from ancient Greek times, specifically Aesop's fable about a fox who refused a hedgehog's offer to take out its ticks lest, by removing those that are full, other hungry ones will replace them. Put as let well alone from the early 1700s, it was first recorded as let well enough alone in 1827.