show customized rights below their _corresponding_ categories

before, if people add new rights(with new categories) by calling
RT::System::AddRights and RT::System::AddRightCategories, all of them would be
listed below 'Miscellaneous' tab, which is not right.

new right categories will be listed alphbetically after core categories but
before 'Miscellaneous'

uninitialized warnings are also fixed.

see also #23158
Merge branch '4.0/fix-right-categries-ui' into 4.0-trunk