Harm, I've been thinking about this, and perhaps you have an idea of how the following can be achieved.
A consequence of explicitly stating the degree in which the stencil has to be rotated is that if anything changes the spacing of that system it's very likely that the degree of rotation will have to be manually tweaked. I was thinking on how to achieve an "automatic" solution. I imagine that this could be done by establishing two points of reference. In this example any two points running along the Beam would serve, although the ending points of two of the Stems would work just as well.
But all this assumes that every object has a distinct name/ID/whatever, like a pointer to it which allows to recover information on it, or at least that one can be given. Do you know if this is possible?
Another approach could be to override the before-line-breaking or after-line-breaking property of the reference Stems with a function that stores the coordinates with a specific name, that can later be recovered by the function that rotates the Hairpin stencil. This sounds simpler than the first idea, although I don't know if Lilypond's internal sequencing allows for this to work properly.
I would love to hear your ideas on this.
Thanks again for being so helpful,
Stéfano.