>>> I do not understand why these ships aren’t armed. It makes no sense at all. <<<<<
Because every port you visit has different laws and customs pertaining to weapons (guns).
The laws should be changed, but that’s the way it is.
Even recreational sailors who visit Mexico and the Caribbean have problems (or concerns) about being boarded by the local robbers. But there is equal concern about being boarded and searched (for weapons) by local customs officials.
So people (recreational sailors) think about “weapons” like spearguns, flare guns, cast iron skillets, heavy flashlights, etc.
Commercial vessel crews have similar problems and responses.
At some point, the owners of these vessels are remiss in ignoring the safety issues of the crew members.