TFS provides a list of templates that I can use for new build definitions:
Once I've used "Save as template..." on a build definition, I can then use it as a template within that project:
But when I switch to a different project, that custom template is no longer available.
How can I create a build template that I can use in any project?
There is no way to directly copy or sync a vNext build definition template between team projects on the Web Portal. The build definition template is only for the present team project. So you need to create a build definition template for each team project.
And also there have been a feature request in user voice, you can vote up and monitor it
VSO build vnext: share build templates between projects https://visualstudio.uservoice.com/forums/330519-team-services/suggestions/8468566-vso-build-vnext-share-build-templates-between-pro
However, for a workaround, you can use the REST API to perform this. Here is an example shown in the blog.
It shows how to get the JSON response of a build definition and again using the same reference to make a new one in the project you desire.
You can also take a look at this nice article: How to move build definitions in TFS to other projects using the REST API