The limiting factor is Miranda API, which imposes certain restrictions about the ways you can talk to database driver. I mean, SQLite IS reasonable fast, by itself. But it highly depends on how do you use it.
Yeah, as both Ghazan and Unsane have mentioned, miranda was initially written for mmap; and so its method of access is more suited towards iterating through events in a list, rather than by fetching all elements in bulk (as you would using SQL-like database). So obviously for "proper" support, miranda core would need to be rewritten as well; which doesn't seem like an easy task. Which is why I'll be content with just the db itself for now. That said, sqlite is a time tested solution which pretty much majority of mainstream software uses, and as such it has had most of its bugs ironed out.
I'm sure mdbx is a great project, but for example the fact 32bit miranda cannot map db beyond certain sizes, and the fact there have been so many issues with it... makes me believe maybe it is not ready just yet.
That said, right now the suspicion falls on discord plugin which - in combination with mdbx - seems to be causing some kind of memory mis-allocation and that is the cause of the corruption. I'm currently testing this theory.