This sounds along the lines of
https://github.com/pulumi/pulumi/issues/1518 and in particular the ideas in
https://github.com/pulumi/pulumi/issues/1518#issuecomment-535677365. This is something we’d love to see added to Pulumi. There's some design details that will need to be fleshed out, but if you are interested in working on this, happy to provide pointers on where to start in terms of designing and implementing an approach to this.
If what you are looking for is related to fundamentally different to what's there - also interested in capturing your needs either in that issue or a new one.