What this derivation shows is that there is no magic involved in the ability of the particle to feel out the entire path before deciding which way to go. At each stage along the trajectory, the particle has only to minimize the action between a point in time and a neighboring point in time.