As Whoops says, you will need a secure mechanical attachment, such as nuts and bolts. Those connectors get pulled hard, and glue alone is unlikely to be enough.
If vibration is shaking your nuts loose, you could use a threadlocker, such as Loctite.
If your connector is the snap-in type, and you’re sure it's secure, then yes, I don't see a problem with using hot glue to take up any remaining looseness. It can be a bit messy though, and doesn't look very "pro". I would be wondering whether the cut-outs are slightly too large.