Lost messages can be recovered by restoring them from a Time Machine backup. Just pick a date/time prior to when you deleted the database files. If deleting the db files didn't solve the problem, there's no harm in restoring them!
In my case, deleting the db files did not help. The image files are on the startup disk, and sharing from within Preview or Photos also fails. It doesn't matter whether I'm sending to an iPhone or an Android phone. The problem cropped up many months after installing Mojave, so if it's the OS, it's something in one of the updates.
Odd that this happens seemingly at random, to only a fraction of Mac users, even some with brand-new systems. That suggests to me that here's something being set or installed by these users that borks Messages.
I'd be curious to know if people with this issue have FileVault encryption turned on - that's a potential factor. Another possible factor is the iPhone being used, since the Messages app on the Mac actually uses the iPhone to do the sending. Mine's an iPhone 7, with iOS kept up-to-date. And who knows what combination of Mac OS, iOS, and iMessages settings (on the Mac and on the phone) might be the culprit? There are more permutations than there are affected users!