While that's as may be in general, the docstring for user-emacs-directory
(in my Emacs 28.2) states "Note that this should end with a directory
separator." specifically, which I take to be part of the variable contract.
Doesn't that imply that it is Emacs's responsibility to handle that aspect
if setting user-emacs-directory based on a file name that may not satisfy
that predicate?
-RTT