Button that changes form field value based on other field values (D8)
I found the solution myself. In case someone else stumbles upon this: In the ajax callback you need to change #value instead of #default_value.

So this callback works:

function sumValues_ajax_callback(array &amp;$form, FormStateInterface $form_state)  {
   $n1 = $form_state-&gt;getValue('number1');
   $n2 = $form_state-&gt;getValue('number2');
   $sum = $n1 + $n2;
   $form['sum']['#placeholder'] = $sum;
   $form['sum']['#value'] = $sum;
   return $form;
}