I recommend LibRedirect instead. It can redirect to both invidious and piped, as well as working for other services. e.g., Twitter → Nitter, Reddit → teddit, and many more
Such extensions exist already. Privacy Redirect (see reply) lets you choose where to redirect YouTube, Twitter, Reddit, Google Translate, Google Maps etc. links. c: