Presumably there is an unwritten postscript to the nuke ban that says "unless sanctioned by Imperial authority." I could see colonial fleets being issued with, or even licensed to produce, nukes for the defence of the realm.
But not your local tramp trader or merc unit...!
There are probably a lot of options that would work.
For frontier states on the Zhodani border (for example) one option would be a dual-key approach similar to that used by the United States with regard to NATO allies. The weapons are "owned" by Colonial navies or major-world planetary armies, and likely even manufactured by them, but there is some degree of Imperial permission and liaison involved as a prerequisite for actual release, perhaps in consort with the ranking noble on the planet.
The situation need not be perfect. Any TL 7+ world can probably manufacture nukes themselves; any TL 8+ world can likely do it with ease. Restricting ownership is probably impossible, so the Imperium would work to ensure severe punishment for use combined with a system that lets worlds possess them for self-defense in event of "bad war" (Zho invasion, Solomani invasion, Aslan invasion, massive Vargr raid, etc.) under some form of control.
A local nuclear war is a problem, but the Imperium has many thousands of world and loss of a city or two, or even a planet, is tragic but not disastrous. Robust after-the-fact deterrence by the Marines and Navy, punishment of all surviving individuals, combined with protections such as nuclear dampers on major worlds and detection systems in starports to prevent smuggling of devices by terrorists should maintain the Imperium's rule of law.
We know that nuclear war within the Imperium's borders occasionally occurs (Xiwa in the Solomani Rim). My own theory is that the latter was the result of hiddenr planetary WMD from Solomani Rim War era stockpiles, but occasional breakdowns of the system keep the Marines hopping.
The idea of Free Traders using nukes for self defense is probably unlikely though perhaps not necessarily out of the bounds. Heinlein's CITIZEN OF THE GALAXY makes a good case for larger trading vessels carrying a few nuclear weapons for self-defense against pirates when operating in neutral space beyond the law. In practice, I expect no starport would be willing to allow traders to dock if they had reason to believe they would be carrying nukes. The loss of a starport or highport would be devastating.
It is probably wise not to worry too much about this, though, as the potential lethality of free traders gets into the whole c+ rocks debate.
In practice I would say the nuclear weapon ban in the Rules of War are primarily one intended to regulate the use of *tactical* nuclear weapons on the battlefield in internecine wars the Imperium permits as a safety valve. If nukes were allowed these would not be a safe way to blow off steam and the Imperium would be forced to ban all wars involving high-tech states that might have nukes to avoid escalation.
If the Imperium had to ban all wars, it would cease to be the Imperium as we know it, and become a more interventionist state like the Zhodani.
The nuclear weapon ban, therefore, exists less to protect the Imperium's monopoly on nuclear violence and more to allow the Imperiuim to maintain its "hands free" policy over planetary states and the trouble they get into.