Hi, Jacco.
I have found that using the homebrew package manager --
https://brew.sh/ -- on Linux and macOS makes having an up-to-date version of pandoc very easy, and I just tried the include-files.lua filter with your command line
pandoc --lua-filter=include-files.lua sample.md --output result.html
using the homebrew installed pandoc (version 2.17.0.1) on Fedora 34 and it worked fine there. I use homebrew on an Ubuntu box at work, and although I've not tried this specific example on that machine, the other things use pandoc for work fine there.
--