This is something you would need rarely but definitely worth knowing something like this is possible.
Let's look at how to add event listeners dynamically in LWC templates.
If the event is always a click event, then we can straight away use
onclick attribute on the template tags (we don't have to take this route).
Here is the template file associated to the web component.
Hope this helps!