This is very much like the least action principle [0]. The optimal path between two points is the combination of optimal paths between the starting and an intermediate, and the intermediate and end points.
[0]: https://en.wikipedia.org/wiki/Stationary-action_principle