Checkhealth - ERROR: $VIM is invalid: $HOME/.config/vim

I share most of the configuration for vim and neovim between them and I set $VIM like this…

if has('unix')
  let $VIM = "$HOME/.config/vim"
elseif has('win32')
  let $VIM = "$HOME/vimfiles"
endif

…which makes it possible to set file paths elsewhere throughout the configuration for both Linux and Windows without using conditional statements.

According to :h $VIM this is fine and pretty much the intended purpose of the variable. So why does :checkhealth give this error message?

## Configuration                                                                                                                                                                                                                                                                                                                                                  
  - ERROR: $VIM is invalid: $HOME/.config/vim