How do I write a template file for a specific input field?
If you want to add a more specific template name to an input element use a theme name suggestions alter hook:

mytheme.theme

function mytheme_theme_suggestions_input_alter(&amp;$suggestions, array $variables) {
  $element = $variables['element'];
  if ($element['#type'] == 'textfield' &amp;&amp; strpos($element['#id'], 'edit-subject-') === 0) {
    $suggestions[] = 'input__textfield__subject';
  }
}

function mytheme_theme_suggestions_textarea_alter(&amp;$suggestions, array $variables) {
  $element = $variables['element'];
  if (strpos($element['#id'], 'edit-comment-body-') === 0) {
    $suggestions[] = 'textarea__comment_body';
  }
}


You find more information here hook_theme_suggestions_HOOK_alter.

If you don't find the data you need in the elements variables, then you have to add it in the form build process, for example in a form alter hook. In this case the form build has already provided the necessary information in the element id.