What is the intuition behind the formula P = 2n in computing alternator stator poles?
The number of poles is not determined by the number of slots. The formula P=2n is more like a determination of the maximum number of poles that should be wound with a a stator having a given number of slots. The number of poles is determined by the distribution of the windings. There are many ways to distribute the windings. A higher number of slots provides more flexibility in winding distribution. However too many slots would mean wasted iron. Determining the optimum design is a matter of balancing the several design specifications with the several design parameters. Generally a number of possible designs need to be simulated to design a machine with a given set of design specifications.
Upon further consideration, the equation P = 2n doesn't seem to make any sense at all. The following is an attempt to explain the determination of slots per pole per phase.
Stator Winding Description
Here is a picture showing one half of one end of a 2-pole, 3-phase motor that has 24 slots.

The motor has 24 slots, so the slots per pole per phase is given by 24 slots / (2 poles x 3 phases) = 4 slots per per pole per phase. You can see that one side of a phase winding phase winding passes through the first slot on the left, goes across the end of the stator and goes back via the last slot on the left and across the other end of the motor. That is two slots used for one coil of one phase. The second coil for the same phase passes through the second slot on the left and returns via the nest to last slot on the right. So that is two coils for one phase and one pole using 4 slots. There are 2 more coils for that phase in the unseen half of the motor making the opposite pole. So that is 4 coils and 8 slots used fo form a pole-pair for one phase. There are 8 identical coils positioned in an identical way to make a pole pair from each of the other two phases.
You can see that the wire size and the number of turns fits into the slots reasonably easily. The slots are narrow enough that there is sufficient iron to carry the magnetic flux.
In designing the motor or generator, the starting point is the desired power or torque and frequency or speed. The desired voltage is selected but must be verified as suitable for the desired power. The desired number of phases is also selected. The frequency or speed determines the number of poles. The length and inside diameter of the stator / outside diameter of the rotor is determined based on the torque and magnetic flux. The number and size of the winding conductors is determined by the preceding design parameters. The number and size of the conductors determines the practicable number of slots and the slots per pole per phase. The complete design includes loss calculations, cooling design and other factors. Detailed design calculations for several alternative designs may be required to produce an acceptable design. An optimum design would require at least several multiphysics simulations.