In my opinion, the pages created from template do not have internal links with the template, we need to update each page manually.
But if you use master shapes and when you them in stencil, all instances of these master shapes could be updated.
To better help you, I suggest you post a new thread on forums mentioned on following link to check whether the code could help you.
Visio developer community
Thanks for your understanding.
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.