So I had this strange issue where I went into an old save game with my new mod, leveled up to reset the merchants, and only 8/10 of my skillbooks appeared on the merchant.
After double checking everything I went back to the treasure table and removed all the entries for those 2 missing skillbooks and then added them again to each table.
This time I noticed that although I clicked the second treasure table in the list and chose "Add Sub Stat" it places the new entry at the bottom so it looks like it's apart of the next treasure table.
Even weirder, if I use the search bar to filter out a single treasure table it appears that these missing entries are because they are created not as sub stats? One was missing from all three tables even though if I remove the search I can see it 3 times.
Editing the TreasureTable.stats by hand I can see examples like this:
<stat_object index="40" is_substat="true">
<fields>
<field name="Name" type="NameStatObjectFieldDefinition" value="New_Stat_10" />
<field name="DropCount" type="StringStatObjectFieldDefinition" value="1,1" />
<field name="ObjectCategory" type="StringStatObjectFieldDefinition" value="I_SKILLBOOK_Air_BlinkStrike" />
<field name="Frequency" type="IntegerStatObjectFieldDefinition" value="1" />
<field name="Using" type="BaseClassStatObjectFieldDefinition" value="ST_Skillbook_AirTrainer" />
</fields>
</stat_object>
Where the red should be ST_Skillbook_AirTrainer_substat_ + number
There is also one case in each list where the red is just: ST_Skillbook_AirTrainer_substat with no number added.
Edit:
From messing around with editing it by hand and in the editor at the same time it seems like the problem is that when you first add a new sub stat, it puts in the name value as such "ST_Skillbook_AirTrainer_substat" missing the "_Number". If you make another, it will abandon that completely for the New_Stat name for the rest within that table.