So you can't replace twenty 12lb guns with a larger number of 4lb guns because the number of gun mounts is fixed. The gun crew are happy because these smaller guns take up less space so they have more room in which to do their jobs. That's until the captain uses up that extra space to fit in some extra cargo, which isn't properly secured because there are no mount points in the middle of the gun deck, so now the gun crew are miserable because the cargo keeps sliding around and getting in their way. Worse, the gun deck is above the normal cargo hold, putting that new cargo above ths ship's centre of gravity, so the ship rolls more. To avoid mutiny, the captain has some mount points jury-rigged. The cargo can now be tied down properly. The gun crew keep tripping over the ropes and mutiny anyway. The last we see of the captain is after the gun crew have thrown the extra cargo crates over the side with the captain tied to one of them.
It's the weight to volume ratio. Cannons don't occupy much space, but there's a lot of empty space above and around them so the gun crew can do their jobs without having to be hobbits who sit on top of the gun while loading it.
So a gun which is part of a ship's armament, as opposed to sitting in a cargo hold being transported to somewhere else, effectively takes up much more volume than its weight would indicate. Plus, as I said, gun deck and cargo hold aren't interchangable without some carpentry work, preferably in a shipyard.
Indeed the volume of the cannons and cargo is very relevant, as is their centre of gravity.
But if we want any feature like this one in the game, some simplification is necessary. Otherwise we would need to include a "ship loading simulator" and that is probably a bit overkill.
Installing smaller cannons or removing cannons altogether has to be done in the shipyard anyway (excep when cannons are destroyed in battle, of course).
So you might imagine that this action also comes with the required changes to the ship's structure.
Having lighter cannons installed does mean you can load more cargo without your ship being at risk of sinking.
This is assuming that the HOLD is large enough to fit all this extra cargo, though.
But if we don't make that assumption, none of this is ever going to make any sense.
Which would be a bit of a shame because a trade-off between cargo capacity, cannons and number of crew could make for more involved gameplay.
Perhaps a cannon should be counted for LESS than its actual weight.
That way, if you remove a cannon, you only get a little bit of extra cargo space and not the entire real weight of the cannon.
This to simulate the effect that a cannon takes up more space than just its own volume.
An alternate idea would be to give each cannon equal weight, regardless of calibre to simulate them effectively occupying near-equal volume.
Of course this bypasses any stability concerns from too heavy cannons (ugh, WASA!), but I don't think we can make it weight AND volume-dependent.
Which is to say... While that probably
is theoretically possible, it would make a complicated modification even more complex.