Each time you run :fileviewer command, you add a viewer instead of replacing it. You can make environment variable part of the command that Vifm passes to the shell instead:
if executable('eza')
execute 'fileviewer' '*/' 'eza -Tl$VIFM_SHOW_FILES_IN_TREE --color-scale=all --no-time --no-permissions --no-user --total-size --color=always --icons=always --follow-symlinks %c'
elseif executable('tree')
execute 'fileviewer' '*/' 'tree -hC --du %c'
endif
let $VIFM_SHOW_FILES_IN_TREE = 'D'
command SwitchFilesInTree :
\| if $VIFM_SHOW_FILES_IN_TREE == ''
\| let $VIFM_SHOW_FILES_IN_TREE = 'D'
\| else
\| let $VIFM_SHOW_FILES_IN_TREE = ''
\| endif
\| FilesInTree
Also note in your original snippet %c needed to be %%c to avoid expanding them when you run :FilesInTree instead of when a viewer is executed.