Looks like you are using the secondary attachment on the back hand there, I’m not entirely sure what your grip setup is but you would just always want the secondary attachment property to be on the rear hand grip and targeting the front hand as the attachment point.
If you are using the template gun, it switches primary hands when you drop the rear if the secondary is attached, it then switches back to the rear as the primary if it is gripped at the socket, it may be that you changed the socket setup of your gun and its not performing that flip.
Since that part is all in the bps you can freely change the logic to correct it for your use case.