Task-level variable exports would help us reduce global exports over time, which would make signatures, and therefore sstate, slightly less brittle. See https://gist.github.com/kergoth/8410245 for a functional prototype.
I like the idea in principle, its probably better added into bitbake itself though to avoid accessing things like __BBTASKS. I did start to add some better bitbake API for task addition/deletion FWIW too, I had intended to extend it further but never had the time/need.
Agreed, adding it into bitbake itself would be better. I'll throw together a prototype if I manage to find the time (right..).
This was implemented quite a while ago.