Sorting layers in layers panel
Having to deal with the lack of any sorting in the layers panel a lot of times, I made a plugin to allow you to sort layers based on their name, geometry, feature count, extent...
You can also group layers that share some attributes.
Lastly, there's a snapshoting ability to copy the tree order which you can use to save the tree before making changes or loading whole or parts of the project into other projects (snapshots get saved as files on disk, they do not reside in RAM).
If you find bugs or want more functionality, consider contributing code or just suggest features/adjustments.
Layer Tree Tools