Is hot glue a good insulator?
There are a variety of hot glue adhesives, and there's no blanket statement that could be made to cover all of them.
However, I has seen industry use (ie, on the assembly line) of hot glue around the capacitors of the high voltage section in a CRT for vibration purposes. The glue came into contact with many of the leads and PCB tracks in that area of the PCB, so I know that there are hot glues which are suitable for electrical use, and appropriate even for high voltage insulation, though insulation was not the primary goal in this case.
You can test your hot glue with a mega-ohmmeter if you have concerns about the particular formulation you are using.
Is there a better way to mount these relays?
There are relay mounts and sockets for many styles of relays. You can also get relay connectors and relays with mounting tabs. These are preferable to adhesives for many applications.
When I've needed to mount relays in a chassis I've used zip ties and hot glue for short term and light duty usage, and metal brackets for heavy duty or long term usage.
I don't typically use hot glue on the bare wires and terminals themselves, and if I do I use heat shrink tubing to insulate the wires and terminals first.
Even if hot glue is a good insulator, you have to look for the components found in it: they may be corrosive or harmful. My experience with hot glue in the past was bad. I have used it on the bottom of a low power (5 V) PCB to insulate it from the metallic enclosure - this has led to mysterious failures of boards after 3-6 months.
The material used in PCBs to hold large components, such as transformers and capacitors, in position is usually silicone RTV, which is specially made for electronics and contains no acids that could harm copper and tin solder joints.
An example can be found on digikey: https://www.digikey.com/catalog/en/partgroup/rtv-silicones/32319
An alternative would be to use relays or contactors that contain screw terminals for wire connections and a DIN rail for mounting.
I have used glue sticks in high (22kV and above) and low voltage electrical circuits for many years and have never encountered any problems. In terms of resistance, the glue will be open circuit on an insulation tester. You would need considerable heat to melt the glue sticks, so there should be no problems in terms of heat causing the joints to melt. All in all, in my experience, it's a go!