Can I put a hanger derailleur on a direct mount frame?
Usually it's fixable either via helical insert (Helicoil) or a threaded sleeve called a dropout saver.


Dropout Saver



Helical Insert

The Helicoil approach gives a neater result. It requires either having an expensive tool (an M10x1 Helicoil kit) or paying a shop to do it.

Dropout Savers are somewhat quick and dirty. They have the very trivial disadvantage that because they're essentially a nut for the derailer bolt, you may need another wrench to install or remove the derailer. But they work fine and are the cheap solution to this problem, especially if you want to fix it at home. They come in different widths.