The only way for extensions to work is to be able to have access to your dashboard and it's data. However, you do not need to use the extensions in the gallery, you can have extensions running locally or on an internal server so your data is not sent externally. A few of the extensions in the gallery do have their source code on GitHub and as of yesterday, all Tableau-made extensions are now openly available on GitHub too! We have heard a few people give similar feedback to this though and I want you to know we are currently putting together a plan to allow extensions found in the Gallery to run without connecting to the internet but in the meantime, running them on your own is your best option.
In addition to what Keshia Rose mentioned, if there are extensions that you are interested in, I would encourage you to reach out to the developer to inquire about this. Most extensions are going to need some level of access to data, otherwise they wouldn't be able to provide much in the way of added functionality. However, just because an extension is accessing data does not mean it is sending data outside of your network. As an extension developer, there is actually quite a lot I can do without ever sending your data anywhere. For example, if I wanted to build a custom chart type as an extension, I could almost certainly implement this without needing to send your data back to my server.
During TC18, I had a chance to spend time with quite a few of the folks who build and maintain extensions and they are a super sharp group that is eager to help with anything extensions-related. So please do feel free to reach out and I'm sure they'll be able to provide you a lot more info on how the extension is implemented.
Best of luck!
Full disclosure: I do work for a Tableau Partner who builds/maintains an extension.