'Trim to Roof' uses a cutting body that sits under the roof.
There is an 'on-screen' option to turn this cutting body on in 3D.
The cutting body can be set to the pivot line extent or the edge of the roof.
When you perform the trim, you decide whether you want to trim the wall inside or outside of the trimming body.
As you connection is on the outside, that may explain why it disappears (gets trimmed away).
You will also have issues with the strengths of your building materials - stronge bulding materials cut weaker ones which is why the wall show through to the top surface of the roof.
Personally I use Solid Element Operations with roofs (I am a bit old school - this is all we used to have).
Use 'Subtract with upward extrusion' to trim away the top of the wall above the roof.
One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10