I love that. I've played most Zachtronics games as well as Robot Odyssey at 15, was hooked on Robot Odyssey for a week for the same reasons. The difficulty was a challenge rather than an impediment.
What really got me was that the games encouraged something like hand-optimizing the size of your program. The levels were open-ended and the solution could be anything, but each solution has a cost, for example, least number of gates used in Robot Odyssey. In SpaceChem, it's number of symbols. In The Codex of Alchemical Engineering, cost is measured in total number of instructions, which encouraged solutions involving many different parts moving perfectly in sync. Those solutions were really difficult but rewarding to craft. However, cost in Opus Magnum is measured in total cost of parts (not instructions) used. That's less interesting to optimize, since the 'best' solution is often one part doing all the work (easy to optimize for), which in my opinion makes it a little less fun to play. Similarly, I remember the last few levels of Robot Odyssey didn't have much space in the way of optimizing (there is just one Correct Solution) which was underwhelming.
I guess my point is that the games were fun not because I had so much freedom in how I can finish each level. Rather it was the difficulty of optimizing each solution that attracted me. And it's hard to find games like that outside Zachtronics.