Fix attaching AJAX behaviour in case of element id is randomized
If the element is replaced by AJAX command its HTML id may have changed because of id randomization. In that case it's behaviours are not attached. This fixes it because AJAX commands don't replace data attributes. It's also recommended to use data-drupal-selector attribute instead of id.
Closes #3207786