I can't speak to the intricacies of the law, but I can speak to common sense. I think this kind of law was put into place in order to force the parties to abide by the results of primaries. I.e., to prevent them from parachuting in a new candidate against the will of the people. Probably a Progressive Era thing.
OK. I got the motivation, but not the historical era.