How can I prevent users editing custom fields for contacts not in their ACL group?
Can you try applying the PR changes to your current version of civi? you will need to apply it manually as the pr is closed and is very old. If you will apply it manually than it may give you conflicts errors.