Although the immediate matter under discussion was re Merchant Navy, @adouglasmhor's reply was more general in its reach and your statement was in response to that, without qualifying the scope.
I'm sure others know more about the background to the longevity of the ban, but I would suspect that there was more to it than simple Victorian morality. For example, having one's non-crew wife on board could be seen in a completely different light to bunking up with a fellow, likely male, crew member. I'm guessing this consideration is at least partially behind the original intent of making it illegal in the first place, ie, to mitigate the deleterious effects of personal relationships on crew effectiveness and morale, not to mention potential abuses of power. Considering points in isolation is possibly not the most effective way to understand matters.
The reason that it took until 2017 wasn't anything to do with crew effectiveness but the fact that it had been overlooked in the 1994 Criminal Justice Act.
The 2017 Act repealed 2 sections of the 1994 Act.
As for bunking up with male members (snigger) that was happening in the merch back in the 70s and nobody batted an eyelid.