Semi-related: I always wished there was something like the unholy combination of a spreadsheet and notebook rolled into one. I picture it notebook-like at the top level, then each cell is a widget that the host language can reference parts of in other cells (probably with a variable (eg: something like mathematicas `Out[_]`) or a built in construct (like the `$ABC123` forms in spreadsheet formulas)). A notebook interface would also be good (I think) as a straight up terminal as well, as you (I) typically want to run commands in an order like in a notebook
Some time ago, I remember Microsoft having made a video for a "courier tablet" that was essentially an electronic notebook. Either side of the spine was, by default, just plain "paper" that could be drawn or written on. It had some kind of intelligence to recognize stuff, so if you started drawing out a grid it had basic capabilities that could be attached to that grid, like spreadsheets.
At least, these are things I think I remember. It's not quite what you're imagining, but it was cool and along the same lines.
Do you know TreeSheets[1]? It kind of sounds similar to your notebook idea.
https://strlen.com/treesheets/
I think that combination exists using Obsidian.md, via built-in "Bases", or dataview / datacore plugins.