Illustrator Main Menu > Window > Astute Graphics > AG Layer Comps
Both applying a layer comp and applying the last document state can be recorded and played back as actions. When recorded as an Action, layer comps are not identified by name, but by their position in the list.