I think that it is a feature of how the basis set is defined. 6-31G is a valence double-zeta basis set of the Pople family. Here, 6 means that the core orbitals are represented with 6 Gaussian functions (GTO) while 31 means the valence orbitals are split into two orbitals with the scheme 3 GTO + 1 GTO. So, I looked at the basis set data for 6-31G, and it seems to be clear how the orbitals are assigned.
For example, look at the basis sets of N, P and As (group 15):
NITROGEN
S 6
1 0.4173511460E+04 0.1834772160E-02
2 0.6274579110E+03 0.1399462700E-01
3 0.1429020930E+03 0.6858655181E-01
4 0.4023432930E+02 0.2322408730E+00
5 0.1282021290E+02 0.4690699481E+00
6 0.4390437010E+01 0.3604551991E+00
L 3
1 0.1162636186E+02 -0.1149611817E+00 0.6757974388E-01
2 0.2716279807E+01 -0.1691174786E+00 0.3239072959E+00
3 0.7722183966E+00 0.1145851947E+01 0.7408951398E+00
L 1
1 0.2120314975E+00 0.1000000000E+01 0.1000000000E+01
For nitrogen $\ce{1s->6 GTO; 2s,2p->3GTO + 1GTO}$. A feature of the Pople style basis sets is that the s and p orbitals are fused when possible into an SP orbital (also called "L" orbital). This means that the s and p GTO's from the same orbital have the same exponent, but different coefficients. This was done to reduce the cost of calculations.
PHOSPHORUS
S 6
1 0.1941330000E+05 0.1851598923E-02
2 0.2909420000E+04 0.1420619174E-01
3 0.6613640000E+03 0.6999945928E-01
4 0.1857590000E+03 0.2400788603E+00
5 0.5919430000E+02 0.4847617180E+00
6 0.2003100000E+02 0.3351998050E+00
L 6
1 0.3394780000E+03 -0.2782170105E-02 0.4564616191E-02
2 0.8101010000E+02 -0.3604990135E-01 0.3369357188E-01
3 0.2587800000E+02 -0.1166310044E+00 0.1397548834E+00
4 0.9452210000E+01 0.9683280364E-01 0.3393617168E+00
5 0.3665660000E+01 0.6144180231E+00 0.4509206237E+00
6 0.1467460000E+01 0.4037980152E+00 0.2385858009E+00
L 3
1 0.2156230000E+01 -0.2529241139E+00 -0.1776531273E-01
2 0.7489970000E+00 0.3285184468E-01 0.2740581964E+00
3 0.2831450000E+00 0.1081254762E+01 0.7854215630E+00
L 1
1 0.9983170000E-01 0.1000000000E+01 0.1000000000E+01
For phosphorus, $\ce{1s->6 GTO; 2s,2p->6 GTO; 3s,3p->3 GTO + 1 GTO}$
S 6
1 0.1005955000E+06 0.1726750000E-02
2 0.1510482000E+05 0.1323462000E-01
3 0.3440884000E+04 0.6535848000E-01
4 0.9703961000E+03 0.2278042000E+00
5 0.3112852000E+03 0.4774525000E+00
6 0.1066284000E+03 0.3567619000E+00
L 6
1 0.2166679000E+04 0.2271761000E-02 0.3832156000E-02
2 0.5165414000E+03 0.3033475000E-01 0.3023558000E-01
3 0.1678674000E+03 0.1259057000E+00 0.1328632000E+00
4 0.6364638000E+02 -0.6687172000E-02 0.3447648000E+00
5 0.2613673000E+02 -0.6065306000E+00 0.4640368000E+00
6 0.1085439000E+02 -0.4823144000E+00 0.2064824000E+00
L 6
1 0.9506989000E+02 -0.5587423000E-02 -0.6816583000E-02
2 0.3318087000E+02 0.5632506000E-01 -0.2970303000E-01
3 0.1406773000E+02 0.2625835000E+00 0.4704335000E-01
4 0.6153288000E+01 -0.1718349000E+00 0.3645042000E+00
5 0.2721712000E+01 -0.7175645000E+00 0.4945157000E+00
6 0.1185334000E+01 -0.3184598000E+00 0.2149830000E+00
L 3
1 0.1615315000E+01 0.2645372000E+00 -0.2574061000E-01
2 0.5513300000E+00 -0.1952737000E+00 0.3072764000E+00
3 0.2227620000E+00 -0.9595400000E+00 0.7537368000E+00
L 1
1 0.8292300000E-01 0.1000000000E+01 0.1000000000E+01
D 3
1 0.5030227000E+02 0.8144711000E-01
2 0.1384166000E+02 0.3792908000E+00
3 0.4393458000E+01 0.7040401000E+00
D 1
1 0.1310755000E+01 1.0000000
For arsenic, I believe the assignment is:
$\ce{1s->6 GTO; 2s,2p->6 GTO; 3s,3p->6 GTO; 4s,4p-> 3 GTO +1 GTO; 3d-> 3 GTO + 1 GTO}$
The same number of orbitals and GTOs are used in the same row. For example, if you look at the 6-31G basis set for silicon, you would see the same type of assignment as in phosphorus. This type of scheme seems to be consistent in other basis set families too, as mentioned in @NikeDattani's answer.
[All basis sets are from Basis Set Exchange: https://www.basissetexchange.org/, and in GAMESS(US) format]