The main purpose of the derailleur hanger is to break at the right moment and to save the more important elements of the bike: the expensive frame and the shifter. But seriously, a derailleur hanger really acts as a "fuse" in case of a sudden impact, no matter whether this is getting into the spokes, an accidental impact, a bad fall, chain blocking, etc. In such cases the whole force of the impact goes to the derailleur hanger, and the owner of the bike does not have to buy a new frame.
That's why a machined derailleur hanger always has a special elaborate structure.
Have a pleasant and a safe ride!