Now, it should be noted there's two major versions of the index list, technically six but you can organize them into two (though between the first four versions there are index number differences with certain Types).
In Gen I and II they actually had separated the Physical and Special Types with a big gap of "Normal" blank index slots; Starting from "0" it began with the Physical Types then after 8 (Gen I)/9 (Gen II) jumped to "20" where is listed the Special Types. In terms of programming logic, this isn't a bad idea. Since there was less than ten of each category this was a pretty good way to prevent most accidental calling of a wrong Type (at least from a different category; and even then there's no preventing all syntax errors). By Gen III they likely decided to clean-up the code feeling they didn't need the gap of blank Types anymore.
But now onto the actual list. THOUGH, I'm going to include the abnoral "Types" in parenthesis as I feel their placement, at least for one, is important in showing for the index list they may have put more thought into where they placed the Types instead of strictly when it was programmed in:
0. Normal
1.
Fighting
2.
Flying
(Once again we start with Normal as the "neutral/default" Type. We're now going into the Physical Category which I feel makes sense as, though Pokemon are fantastical creatures and the Starters are noted for their Special Types, most early mons are in a sense "grounded" to what they're based on. Infact "grounded" is a good word to use as the Physical Types sort of make a foundation which the Special Types expand upon. Thus Fighting would feel like the next "step up" after Normal. Now one could say it's odd Flying isn't Special as it represents a creature that also can control wind, but GF here was probably initially thinking of a creature having the ability to fly as a physical trait and would attack by swooping down or surrounding itself in wind via spinning or flapping its wings. And due to quite a few Pokemon being either birds of having wings, plus flying giving you an obvious advantage over grounded fighters, would explain it being the third programmed Type)
3.
Poison
4.
Ground
5.
Rock
(Poison my feel like an odd early inclusion at first, or at least listed as closely with Fighting & Flying, but I feel it makes sense. Poison turned out to be a pretty common Type, usually a secondary one, likely because venom is a common biological trait used by many animals for both predatory and defensive mechanisms. In addition, when you think of status ailments in not just Pokemon but gaming overall, "poison" is one of if not the most common so could have been implemented early to help test the status ailment mechanic. However after it comes the "Earth" Types, which you would expect to come not soon after Flying; not just from a logical standpoint but also their Type match-ups connected to Flying. I'm not going to go too much into it, but Pokemon is pretty unique by splitting its "Earth" Types into Ground and Rock, and all for the purpose of the Type System so their early inclusion with how they interact with Flying is even more notable and obvious)
(Bird-Type)
6.
Bug
7.
Ghost
(And here we are. While Poison is an oddball for a "Type", you could loosely justify it being an "element" rather than characteristic. But the same can't be said for these three. Bird, Bug, and Ghost aren't elements, it's a general descriptor of what real animal or mystical being the Pokemon is based on. Like with splitting the "Earth" Types, it's one of the things which makes Pokemon's Type System standout. But due to their "out-of-the-box" concept, it explains why they're listed as the last of the original Physical-types; as common as Bugs were, as a Type they weren't necessarily needed for early implementation as they add no unique interactions the above Types didn't already do. Infact the later inclusion of these Types could indicate that GF mostly saw them as "defense defining" Types, as in they were notable for what they were weak & resistant too rather than what Types would be weak or resistant to their Moves (which they didn't have many of). So with that insight, let's discuss the Bird-Type in the room. In Gen I & II coding it was originally index 6, and it being right next to Bug & Ghost (and possibly also Rock) makes me now think initially its inclusion as a Type would have been similar to what I just theorized now. Bird and Flying may have had different Type interactioned initially planned, like Rock may have been super effective against Bird but no interaction with Flying, but maybe after more development they came to the logical conclusion that what most things birds would be weak/resistant to so would any Flying creature, thus most if not all of Bird's interactions added onto Flying and all but dummied out as a Type. AND, maybe going deeper down a rabbit hole that doesn't exist, what if Ground & Rock were originally one "Earth"-type which had different interactions with Bird & Flying (Earth was uneffective against Flying but super effective against Bird), BUT when Bird's interactions were folded into Flying they realized they needed to split it to keep the interactions but explain it better!)
8.
Steel
(???-Type)
(Nothing really mysterious here, Steel was made index 8 as it was the new Physical Type added in Gen II when they still had that "blank gap" between Physical and Special Types. ???-Type is a funny little Type as it was made just for the Move Curse due to it having a different effect if the user was a Ghost-type or not. In Gen II it was index 19 putting it just before the Special Moves, Gen III was pushed up to index 9, and finally in Gen V it was removed pushing all the Special Types up one slot (and Curse became a Ghost-type Move). This is funny as, though they removed the "blank Types gap", this meant until Gen V there was still something dividing the Physical and Special Types. Infact, since it took the 9 spot, that meant the Special Types still started when the index numbers entered the 2 digits, so maybe this placement was still intentional (at least until they decided they no longer needed it)?)
9.
Fire
10.
Water
11.
Grass
(Now, the funny thing about this index discussion is that, since in Gen I they purposely separated Physical and Special Types, that means they very likely have working on both lists at the same time! Fire, Water, and Grass very much existed in the code at the same time Normal, Fighting, & Flying did; they were just part of different groupings. Now, I still wouldn't be surprised if the Physical Moves were added first and then the Special, but it would be more of a gradual criss-crossing. Anyway, even on the index listing poor Grass is still listed last, but once again I feel that makes sense. Fire and Water are considered "classical elements" in many different cultures, Grass was likely added as a logical third to create the "Type Triangle"; maybe also possibly inspired by the Chinese classical element of "wood". But Grass would get the last laugh with getting to be the first Type in every Regional Dex, likely all because they felt Bulbasaur looked more unique compared to Charmander and Squirtle)
12.
Electric
13.
Psychic
14.
Ice
15.
Dragon
16.
Dark
17.
Fairy
(From here I don't think the ordering needs much explanation as it adds in the Type where you'd expect it to show up. Electrics show up before Psychics, Ice is famously late appearing, and Dragon has special status along with Ghost so appears at the end for the original Types. Gen II adds Dark to Special because it makes more sense to add Steel to Physical. And finally Fairy was added after GF compacted the Type index list so automatically gets listed as last (though funny enough probably would have been designated Special))
19. Magical Number
99. Stellar Type
(BUT WAIT, THERE'S MORE! As a final bonus, Scarlet & Violet added two new "Types"! Yes, two; and its all thanks to Tera Types. The most familiar one would be the "Stellar" Type, that super special Tera Type that even gets placed down at index 99 just to show how special it is (and, since its listing at 99, they can actually keep it in the code for all future games so if they ever bring back Terastallization it's right there). But, what's that "
Magical Number" one listed at index 19? Well, according to Bulbapedia, it also has to do with Terastallization. Apparently its the index number superficially for a Tera Type that has not been changed from its original value. What does that mean? Don't know. If I had to guess, probably something involving the mechanic to change Tera Types in the Treasure Eatery as it's the only thing where I would imagine whether a Tera Type has been changed would matter)