Vimscript (well, Ex) is weird in that each command will determine whether they'll take | as an argument or whether they'll allow it as a separator.
In the case of user-defined commands, they default to taking | as an argument, but you can override that by passing a -bar argument to the :command definition.
So, defining Test this way would have prevented the issue:
com -bar Test echom 123
See :help :bar for more details and a list of commands that take | as an argument:
These commands see the '|' as their argument, and can therefore not be followed by another Vim command:
:argdo
:autocmd
- ...
- a user defined command without the
-bar argument
To be able to use another command anyway, use the :execute command.
See also :help :command, in particular the part that covers -bar.