A husband was forced to tie an extension cord around his wife and walk her like a dog as part of a humiliation ritual while also being held at gunpoint and beaten during a terrifying home invasion as their children slept just metres away, a court has heard.