Here’s a new perspective on this:
No DOM access. Instead expose a fluent API to work with the data in the doc (get rows, get cells, enumerate columns etc), directly with the data in the doc and not through remote API calls. And that would solve all the problems in the world.
Well, it won’t solve the UI extendability, but in this last year that turned out to be not as important as the ability to quickly calculate and transform large data sets, for which I had to invent many workarounds like this. On the other hand, if this JS can use Canvas to create images and SVG to create interactive pieces, and we could insert the result of that function in a canvas or a cell — that would solve the UI extendability need as well.