Get the value of one field from another in the same form
The formElement method in your widget class should include $form_state as one of its arguments. The value of all the fields in your form should be available in the $form_state object: 

example: $form_state->getValue('field_b');