Yes, you can just compile kernel modules, but you take the risk of crashing the kernel. eBPF provides a safe way to interact with the kernel due to not being turing complete and additional restrictions. Systemtap is another example of such language but compiles to kernel modules instead.
This is quite important when you want to run this code in production. You don't want to accidently crash your kernel.
This is quite important when you want to run this code in production. You don't want to accidently crash your kernel.