Default create apk to edit system files

i want to know how do devs create an apk file that can edit files in system folder. for example sound files etc. generally a flashable zip is created which will replace the stock file with a modified one. The same thing, this time without going into recovery but being able to do it with an app itself.

Yes, ready to learn.