In rocket engines, the objective of the combustion is to produce the maximum ISP, which is to say that the gasses exiting the nozzle have the highest possible speed.
In a typical scenario, changing the chamber pressure does not influence the ISP much. However, the exit velocity is influenced by the molecular weight of the gases, since the same exit Mach number means a higher speed for a light gas than it means for a heavy gas.
This is part of the optimization, which should ultimately lead to optimal performance parameters of the rocket, not the engine, while also taking other factors into account.
For hydrogen, stoichiometric is at a ratio of 8:1, and optimal ISP is attained at a mixture ratio as low as 3.5:1, meaning that more than half the hydrogen is ejected unburnt. This would lead to extremely large and heavy hydrogen tanks, however, so an optimal choice will be something in between.
For hydrocarbon fuels, the same is true to a lesser extent. CO2 is a quite heavy molecule, so rockets also eject a lot of CO, in order to obtain higher ISP.