It looks like all you need to do is change toe orderby
argument of your wp_get_object_terms()
call. After all, that’s what you’re looping through further down.
If you change 'orderby' => 'ID'
to 'orderby' => 'name'
, your terms will be ordered alphabetically.