If there is more than one matching file then $filename is an array, not a single string. The command wouldn't know how to handle an array and therefore would simply create the directory structure.
To get this to work you need to flatten the array into a space separated string of filenames. The splat operator (@) can be used for that.
robocopy "$source" "$dest" @filename /np /ts /fp