A lot of people would like to do this. It makes sense that a developer would want to select the custom tab automatically, if the controls that are most useful for the current document are all on that tab. This video goes in-depth about this programming question.
OK, not really. The video just says you can’t do it, because the Ribbon is designed with the idea of leaving the user in control of the UI — no surprise selection changes. But you should watch the video anyway. It’s really short, and, you know, kinda funny.
Duration: 1 minute, 8 seconds