I think you can practice it; do some coding excercises, e.g. Advent of Code is coming up again, usually it's only the later ones that require some optimization or clever algorithms (...I never got that far). Or a constrained environment, you can't write long code in pico-8. Or time limited, like a hackathon or game jam.
Game jams and hackathons are a fun and easy way to get a lot better at scoping and saying no, and being able to predict what works or not once everything is in place.
It's a playful environment with low stakes too, compared to working in a startup, so really advice new programmers to participate in order to learn faster.