Use both hooks, and call did_action
to find out if the template hook fired or not.
https://developer.wordpress.org/reference/functions/did_action/
did_action
will return the number of times a hook/action has fired. With this you can return early in the footer action