Honestly the best solution is a ‘code’ field type in ACF. The stripslashes_deep() that runs on text fields and textareas is important. Having a field where it is assumed that code is entered and input is stored *as-is* would make the most sense. It should probably come with a disclaimer, but a lot of us need it.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users