I KNOW WHAT YOU ARE TALKING AND I MAY HAVE A SOLUTION!!
I've been playing online with my wife since day one (I have two xbox one in my home and I dont like split screen). I also played online coop with a friend of mine (each one in our own home)
I only have this problem you mentioned when I turn off my Xbox with the game open (you know... to use fast resume later). Then,when I turn it on again I always have "connection failed" when trying to play coop.
Solution: both of you press the XBOX BUTTON, then on the tile the game is running press the MENU button on xbox controller and select QUIT. Now both of you reopen the game and let it boot completely. Press A to connect to the servers when asked. Now try playing online coop.
If that doesnt work, both of you restart the console by pressing and holding the power button for about 8 seconds and try again.
Xbox is like Windows and most of the things will work if you reopen it or restart the console

Works everytime for me.