They’ve already done it ;)
Maybe you should try Anytype. It’s Open Source, encrypted, has applications for major OSes, provides synchronization, allows export of documents to Markdown and PDF. Sometimes it’s rough on the edges, but I think it has a potential.
Do you have any sources backing your claims regarding Kagi?
I’m using https://anytype.io/. Offline applications for all major systems, synchronization out of the box.