The linear direction of the recoil force may indeed be 90 degrees to the axis of the trunnion, but that is not a solid axis. Rather the axis is interrupted. The recoil force doesn't pass through the axis but past the end. The Trunnions are levers.
When fired the rear side of the end of the trunnion on the carriage provides resistance to the recoil. Force of recoil is applied to the front if the trunnion inside the barrel and the outside edge of the barrel where it bears against the center of the the trunnion is the fulcrum.
Since the exposed trunnion is longer the portion inserted it transmits more force.
Yes you will get some resistance from levering by the mass of the rear of the pocket. But you still get levering.
I use to do trunnions as William Green suggested with a heavy threaded stud. I would make them interference fit and turn them in tight with a barrel wrench.
I went to a cannon shoot one time and had to have my barrel inspected before shooting. The barrel was pulled from the truck and the first thing that was noted was the trunnions on both sides were loose. They would not turn all the way out but would turn a little. When I got home I had to use the barrel wrench to get the trunnions all the way out.
The trunnion had a peen mark at the front where it bore against the outer surface of the barrel. It also had a peen mark at the bottom back of the trunnion where it bore on the back bottom of the trunnion pocket. The screw stud was also bent.
I got with a fellow that was a connon maker and long time millwright and talked the problem over with him. My idea was also to shrink fit. His idea was to just weld them. He said that is what he had been doing for years.
I expressed concern about heat affects of welding. He told me that using the proper welding techniques would minimize those effects.
To demonstrate we built a trunnion pocket in a piece of scrap steel and shrink fit the trunnion in. We put the piece of steel in a vise and smacked the trunnion with a hand sledge. The trunnion went flying across the shop. We put the trunnion back in the pocket with a press and he arc welded the trunnion in place. Thenm we smack the trunnion with the sledge. We dinged up the end of the trunnion pretty good and finally bent it a little, but we did not break the weld or pull it out of the pocket.
He explained to me that the heat affected zone was in and adjacent to the weld and not through the entire barrel. He did tell me that he welds the trunnion before he does the final finish or ream of the bore.
After he welded my trunnions in for me I ran the reamer back it and could not detect any distortion or scaling from the weld. I suspect now, thinking back that I got no scaling or distrotion because the type of weld used was one that minimized the the heat and size of weld plus the mass of the metal being welded localized heat dispersion.
This is the cannon, my very first made after my first semester of Machine shop practice out of 4140 20 years ago.