So, you've done a "brew install xmount" and it worked OK, without errors? Perhaps uninstall xmount and then install again?
Think the command should be something like this (this assumes your container file is located at /Volumes/xxx/container.file and the previous commands in the GitHub article are already done successfully):
sudo xmount --in raw /Volumes/xxx/container.file --out dmg /Volumes/apfs_image
Then continue with steps in the GitHub article , and you will also need to use the "diskutil ap unlockVolume <Disk GUID> -nomount" command since your volume is encrypted and you should already know this GUID, and then the "mount_apfs" command should mount the disk (you need to substitute real apfs device id for the "/dev/disk#" parameter).
Good luck...