I also had this incident recently.
I applied a little bit of solder to the motherboard with a thin soldering tip.
Then with (A clean!) solderingtip, i soldered the hexnut with heat transfer to the motherboard.
i.e. I pressed the hex nut with the soldering tip onto the motherboard.
It is important that no solder ends in the screw thread.
The screw also provides a groundplane to the SSD so soldering would be a better solution than gluing.
I agree that this is a weak construction.
I accidentally did this on purpose, realized to late that it wasn't made to unscrew.. I'm having an issue that the standoffs that came with mobo doesn't fit into the pre-installed hexscrew standoff thing.. I've spent hours trying to figure out how to install my m.2