This is since v1.18.
Anytime you're unloading ammo from a gun or magazine, if the the game needs to create a bullet "icon" (i'm not sure what to call it, but the bullet icons in your inventory that can have a certain quantity of bullets to them before another icon needed).
For example, if you have a 9mm bullet icon in your inventory, and lets say a quantity of 10, you can empty a mag until it reaches 25 which is the max for the 9mm bullet icon. Then normally it'd need to create a new icon and keep going. However now you just lose any additional bullets from the magazine.
And if you don't have any icon of the bullet you're unloading from a magazine, you lose all of them.
The same happens if you're unloaded straight from a gun, or from magazines.