Why does the LED turn on after the while loop becomes false?

There is nothing to order the two times when a value of the variable is put into the memory for that variable.

The sequence points idea is exploited by compiler optimisations, this is exactly why the statement as it was written can produce unintended effects.

Until C++11.

But I’m not standards and experts “guy”.

a7