You should know that however you approach this problem.. Nothing can stop a person from flashing a custom ROM and overwrite whatever you have done as @ModularSynth mentioned.
Now let's talk about making your own kernel. I believe you can find guides to what you are looking for and use your modifications in a modified ROM and flash the device with it here : https://forum.xda-developers.com/showthread.php?t=2152819
With that said... There is still nothing that can stop a user from taking your device and modifying it unless you can find a way to brick it if it is attempted as a security feature.