is there a way to hide a "custom field" in edit mode Drupal 8?
Making this based if it's printed on a view mode, makes things quite complex. You'll have to write a custom module.

Try using the Fields Permissions which is based on Roles. So just check mark the Roles that should be able to see the field in the front.