What about Mathis, though? His 40.5% is higher than any of the challenging Democratic House candidate in Alabama that year.
Some conservatives who hated Roby didn't know about the write in campaign, and so voted D in disgust.
I find it really difficult to imagine Trumpists who are disgusted by a GOP candidate being "Never Trump" would vote for a Democrat out of pure spite, as opposed to just staying home.
I mean some might do that, but staying home seems like both an easier and more coherent thing to do for those who didn't know about the write-in campaign
Spite can be a pretty strong motivator. Some Trump voters might have been so angry with Roby that they wanted to turn her out of office, and voting for the Democrat would be the best way to accomplish that.