A single-class Arcane trickster typically gains spells in the schools of Illusion and Enchantment.
They are permitted a single "any-school" spell at 3rd level (upon choosing the Arcane Trickster archetype) and again at 8th level, such that by 8th level they may know two spells that are not from Illusion or Enchantment.
You know three 1st-level wizard spells of your choice, two of which you must choose from the enchantment and illusion spells on the wizard spell list. (PHB)
The spells you learn at 8th, 14th, and 20th level can come from any school of magic. (PHB)
They are also permitted to replace spells when they level, and while this typically changes the spell identity, it does not change the number of "any-school" spells that they know.
Whenever you gain a level in this class, you can replace one of the wizard spells you know with another spell of your choice from the wizard spell list. The new spell must be of a level for which you have spell slots, and it must be an enchantment or illusion spell, unless you’re replacing the spell you gained at 3rd, 8th, 14th, or 20th level from any school of magic. (PHB as modified by 2020 errata (emphasis mine) and see this question)
However, suppose an Arcane Trickster wanted access to more any-school spells and did not mind limiting their access to Illusion and Enchantment spells in order to do so.
Would the following work?
Upon becoming an Arcane Trickster at 3rd level (3 spells known), they make sure that their third, "any school of magic" spell is actually from either the illusion or enchantment school, and a spell they are not interested in using beyond being a placeholder. Say, for example, Illusory Script.
At 4th level (4 spells known) they gain an illusion or enchantment (IE) spell, but they also replace Illusory Script with the first non-illusion, non-enchantment (NINE) spell they want. They can do this because 'it must be an enchantment or illusion spell, unless you’re replacing the spell you gained at 3rd, 8th, 14th, or 20th level from any school of magic,' and it is the spell they gained at 3rd level from any school of magic.
At 5th level (4 spells known) they do not gain a new spell, but they can replace one of their original two (IE) spells with Illusionary Script. They can do this because the replacement is an IE spell.
At 6th level (4 spells known) they do not gain a new spell, but they can replace Illusionary Script with a second NINE spell. They can do this because while that instance of the spell was not gained at third level, it is certainly "the spell they gained at 3rd level from any school of magic," that is, the same spell identity. [And this definition is what the strategy depends on] We can see that rather than waiting until 8th level for a second NINE spell, this way they can get one at 6th.
At 7th level (5 spells known) they gain a new spell, and take Illusionary Script again. They can also replace a spell, and likely switch out the first level IE spell they learned with a second level one, since they now have access to second level spell slots.
At 8th level (6 spells known) they gain a new spell of any school, and take a second-level NINE spell (their third NINE spell). They can also replace a spell, and replace Illusionary Script again with a another second-level NINE spell (their fourth NINE spell).
Thus by 8th level, rather than having only two non-illusion, non-enchantment spells, they have four, which is two-thirds of their known spells.
This seems to me to be permissible under RAW. Am I wrong in my reading?
Note that currently I am the DM in the game in which there is already an 11th level artificer; I am not asking with the intent of using this as a player, and answers of 'ask your DM if they would allow this' are not necessary. Rather, my greatest contact with the 5e community comes through this site. My question is about whether my understanding of what the rules actually say is correct, and if so, whether people actually play this way ('that's what the rules say, duh') or not ('sure, that's what the rules say, but we all know what they actually mean').
If an answer posits that the rules do not intend to permit this exploit, a good answer would explain on what basis they draw the conclusion that RAW are not RAI. A great answer would suggest a rewrite of the feature in language that unambiguously expresses its intent.