Optimization is generally used as a broader term than what code level optimization means. Although code optimization does help systems vertically scale.
I've seen quite a few projects fail because the engineers didn't think through the ability of the system for handling more users/connections/data. A little thought before starting the project usually helps avoid ops headache and costly rewrites later.