Reading this reminded me of Ted Nelson's work, well documented in [1]. What stands out for me was Nelson's "virtual document" where a document is a list of offsets & spans into a single, growing character string; you don't edit the string, you just append more stuff and adjust the appropriate pointer in the document list.
[1] https://xanadu.com.au/ted/XUsurvey/xuDation.html