Lean only runs hotter in relation to starting off from a rich mixture in the first place.
The hottest flame temperature is at stoichiometric, as that's the maximum possible heat available in the cylinder.
Detonation will rip insulating boundary layers away, exposing materials to the heat, and excess air will allow metals to "burn".
NOx formation is due to chemical equilibrium states, where the presence of substances together will create one or more additional.
e.g. the abiotic oil concept of carbonates and water creating hydrocarbons under heat and pressure.
The NOx reaction has a free radical single oxygen atom (very reactive) attacking a Nitrogen molecule, and busting it, forming NO, and leaving a free N, which finds something else (usually another free O, or a free N to form N2 again). Some of the NOx is decomposing to O and N at the same time.
If you were to hold a vessel of N2 and O2 at the temps and pressures present in the combustion chamber, they would form other species, of NO, NO2 etc. in specific ratios, wehre the rate of NOx formation is exactly matched by the rate of NOx decomposition...in equilibrium.
Same as there will always be CO, and unburned hydrocarbons, even in a stoichiometric mix, as all of these substances must be in equilibrium.
Unfortunately, NOx is a very fast forward reaction, forming NOx quickly, and a slow backwards. So as the gasses cool during the power stroke, the NOx formed at higher temperatures doesn't change back at the rate required, and NOx leaves the exhaust.
More oxygen in the CC, at CC temperatures gives more NOx, and as per ARCO's post, the peak is around 16:1, at which point the equilibrium rates at lower flame temperatures win the NOx race rather than the increased oxygen availability.