Your general picture of ascent guidance is on track, but everything is complicated.
As soon as roll complete, pitch for gravity turn
The exact timing and initial pitch for the start of the gravity turn controls the overall trajectory. Turning too soon or too far means you are not going to space today; turning too late or too shallowly will make you overshoot your apogee.
Penetrate atmosphere at zero angle of attack
Near-zero angle-of-attack is necessary in the lower dense atmosphere, but some launchers pitch up to a slight positive AoA later to take some atmospheric lift. (It was surprising to me to learn this -- I would have thought the drag penalty would be prohibitive.)
When out of atmosphere (~120km), attain apogee of 400 km using main engines gimbal in pitch
At 400 km altitude and apogee locked (pitch at 0), burn till eccentricity 0 (stage if neccessary)
Unfortunately the apogee and eccentricity can't be independently achieved. If you're on a suborbital trajectory with 400km apogee and you burn horizontally, your apogee increases. You can hold the 400km apogee by pitching down during the circularization burn, but that's less efficient than reaching the desired apogee at the same time as reaching circular orbit velocity.
Typically an iterative guidance system is used to reach the desired orbital parameters all at once. The starting point for learning about this in more detail is "powered explicit guidance" (Orbiter Wiki).
engines off at eccentricity 0, 400 km altitude
Note also that some launchers do it differently, cutting off the engines while in an eccentric orbit with a perigee inside the atmosphere (or lithosphere!), then doing a separate circularization burn after a "coast phase". For example, the space shuttle would shut off the main engines and discard the external tank from say a 215km x 50km orbit (ensuring that the external tank would reenter the atmosphere promptly), and then circularize at apogee using the OMS.