Sorting can be done by addons, yes.
There already exists sorting addons like QualitySort and others like this (addon search->"sort")
https://www.esoui.com/downloads/info...yQuantity.html
Not sure how it handles stack sorting as this is difficult and altering the inventory via addons, not using the ESO build in sorting, may break other addons or make the inventory even be "insecure" (tainted) again.