Yanfly's plugin doesn't sort by anything as far as I can tell because states aren't a part of it to begin with. DreamX's is the only way it works, though i have no clue how.
I can't figure out what the default sort order is- there isn't a parameter or anything for that in either DreamX's plugin or Yanfly's Auto Passive States one.
The array I've used for Auto Passive States is:
<Passive State: 4, 51, 52, 56, 58, 59, 60, 67, 68, 69, 73, 74, 99, 101, 102, 103, 104, 105>
But for some reason it gets scrambled on the way out. (I used a console log to check the state display order.)
As for sorting by level unlocks, those were (attempted) to be handled by having dummy states that disappear (using a passive condition) once the required level is reached in the appropriate place in the ordering. For some reason the states sometimes switch places when this happens, and I can't figure out why.
Can you show us the database entries for these states and the noteboxes for them?
Sure.
(Note: how some are coded is that some of them are actually two states: one's a dummy to show up in the menus to tell what it does and the other is for actually doing the business in battle.)
The others you see in between the earlier "unlock at level X" skills are intended for other characters, i'm just using one as an example. They don't show in the first one's passive state array.