Re: Why is Wireguard in the kernel?
It's probably contributed code
You _could_ write a kernel module as a port. I've done it (more than once). Then someone who wants the kernel module can install it from FreeBSD ports, or maybe just copy the port files onto the target machine and build it. All you need is kernel headers and the ports collection to do that.
But inclusion as part of the base system requires that it meet some specific standards, from coding style and naming of variables to reliability and security.
Usually it gets a lot of peer review. At least, that's been my experience in the small number of contributions I've made.
(if you have something good to contribute, it's worth going through the process, spend some IRC time with the core devs, submit it to Phabricator for review, have specific people review it, and so on)