Form element replaced via Ajax callback doesn't seem to be submitting or the values are not appearing in buildForm
The ajax callback returns the part of $form which is inside of the ajax wrapper:

  /**
   * Ajax callback for the color dropdown.
   */
  public function updateColor(array $form, FormStateInterface $form_state) {
    return $form['color_wrapper'];
  }


The wrapper has to be a div container.

Complete code example  https://cgit.drupalcode.org/examples/tree/form_api_example/src/Form/AjaxColorForm.php