Thank you all for good inputs and advises !
As a result of this I will make a following change into my original process: after command sudo pacman -Rs $(pacman -Qdtq) I will add into my process command LANG=C pacman -Qi packageX | grep -E "^Required By|^Optional For" for additional checking if packageX is required or optional. All the rest can remain as in the original process plan. OK ?
In case of no objections I’ll mark this thread as ‘Solution’.