The powers to be are more worried about unintentional discharges, suicides, solider on solider violent.
Then protecting a few.
Traditionally the practice of keeping soldiers away from ammo was a class thing.
Soldiers (and sailors) were lower class and officers were upper class. The rule of the officers was often enforced with great brutality. The officers were therefore always concerned (and quite rightly) about mutiny or revolution. So keep the soldiers or sailors basically unarmed except right before contact with the enemy. That way you could be relatively sure they’d shoot at the enemy rather than you. On ships the arms locker was carefully guarded by officers, or on those ships which had a detachment, Marines.
Officers, of course, went armed at all times, so if necessary they could shoot down an insubordinate ranker. That was, in fact, one of the main distinctions of being an officer and a gentleman. Officers and gentleman could be, and often were, armed. Rankers were not. This applied in all European countries.
The English Bill of Rights, the precursor of our own, said something along the lines of, “The people will be allowed to keep and bear arms as appropriate for their station,” or the social status. Which mostly meant “gentlemen.” The US Bill of Rights, of course, got rid of that and changed it “the right of the people,” full stop.
The reasons for keeping soldiers unarmed, of course, made little logical sense in America from the beginning, and even less now.