I settled on obsidian with the built in sync. The data is as clean as it gets - its very agnostic to the editor as long as it adheres to the markdown standard (plus flavors). I'm aware that I'm creating a dependency on obsidians workflow and plugins, but the cost of switching is very low considering how I use my knowledge base (I could in work case scenario work with my files with standard Unix tools).
You are free to choose whatever tool that works for you, personally I don't want my notes to be held hostage by a single vendor.
The closest to Anytype is logseq, but silver bullet.md is also awesome. And if you choose another markdown editor, you could use rsync/git/syncthing to synchronize your files.
When it comes to note applications, there is no shortage of them. Just make a informed decision that will serve you well in the long term.
Out of curiosity, have you tries logseq or silverbullet.md? They both have capabilities to query your notes similar to Notion.
I've had this challenge with structuring notes-data for a while, but haven't found something that suits my workflow yet. I have on my list to experiment with a sqlite solution.