OpenGL rotates the whole scene, so it doesn't know what object you are rotating and don't need to either, all commands you are sending to opengl is executed in the oposite order as you sended them, that's why it works as it does.