How to use hook_prepare to modify a field of a node before it is edited
The code that is provided by the page that you linked to is wrong. While this hook exists in D7 and while it is possible that during early D8 core development, in alpha or beta, it existed at one point. In D8 there is no such thing as hook_prepare.

As per the list of all D8 core hooks, it looks to me that hook got replaced with a newcomer hook called hook_ENTITY_TYPE_prepare_form

/*
 * Implements hook_ENTITY_TYPE_prepare_form
 */
function mymodule_node_prepare_form(\Drupal\node\NodeInterface $node, $operation, \Drupal\Core\Form\FormStateInterface $form_state) {
  if ($node-&gt;getType() == 'article') {
    // your code goes here
  }
}


and as always, anytime you implement a new hook, for the first time, clear the cache so it gets picked up by Drupal.