Custom validator for checking if fields match
I'm not sure if constraints is the best way to go when you need access to two fields. In your form alter, could you add a custom validation method? That way you would have access to array &amp;$form, FormStateInterface $form_state giving you access to all fields. 

$form['#validate'][] = 'my_test_validate';


And then your validation function...

/**
 * {@inheritdoc}
 */
function my_test_validate(array &amp;$form, FormStateInterface $form_state) {
  // Do what you need to do here...
}