xbps-src runs in a chroot, so all paths you see are actually relative to void-packages/masterdir
So what that means is that masterdir/lib/modules… doesn’t exist.
I never thought about it or checked before, but the xbps-src bootstrap doesn’t seem to have a linux kernel installed (really why should it under most circumstances?)
So if you need a kernel tree to build against, you need to add the kernel (both linux#.# and linux#.#-headers) to the makedepends in your template.
NOTE: I’m not an expert at this, but I suspect that if you’re building a kernel module, putting it in a binary package isn’t the way that this should normally be done. Instead you should always build it locally and rebuild it every time the kernel updates.
To “package” such a module then you’d package it as a dfsg module. (disclaimer - I know very little about that system so I won’t have any suggestions about how that actually works…) For ideas you might want to look at the templates for other dfsg packages.