There are addons that let you just do something like /cast Tier1 and the addon fills out the macro for you if you change specs; but, I've never seen one that uses the talent selection as a condition.
Though, that one I linked could probably be easily updated. It's expecting an empty macro with a specific name (e.g. tier_3). Something could be put in the macro body to give it an override spell and then it could use that instead of the talent spell. But, that's up to you or the author .