Automation - Entitiy_id - Wildcard

Then yes with some templating logic to filter out only entity IDs starting device_tracker.ha_.

Probably something like

{% if 'device_tracker.ha_' in entity_id and old_state == 'unavailable' %}
  ...
{% endif %}