Form in modal dialog: Template suggestions have weird random suffix
Create a .module in your module folder ex : library_assets/library_assets.module

in the .module file use this HOOK to create a new form suggestion that will be dynamically equal to form--{form-id}.html.twig


    &lt;?php
/**
 1. Implement {module_name}_theme_suggestions_form_alter
 */
function library_assets_theme_suggestions_form_alter(array &amp;$suggestions, array $variables) {
  //Get the form id
  // ! - you must replace the '-' with '_' in the suggestion name otherwise it won't work.
  $form_id = str_replace('-', '_', $variables['element']['#id']);

  // adding a new suggestion to the form template
  $suggestions[] =  'form__'.$form_id;
}


now clear the cache and inspect the code again and you'll find a new theme suggestion = form--{form-id}.html.twig