Funny I am just working now on the attributes order for a custom script.

To complete Geert's finding, I changed the attributes order via a script e.g. to update t_attribute.pos values to 1,2,3,4...Opening the class attributes via the GUI and running a right click > Restore sort order doesn't do anything where it should change them to 0,1,2,3 with the default order (which can be found with the creation order stored in the attribute ID).