Being able to use whatever weapon isn't the same as being able to pair any gadgets together. Look at Sundance, they can't run emp grenades, otherwise they would be able to disable sentinels and then throw scatter nades, that would be broken. Another example would be Liz, she can't carry stingers. That's where balancing comes into play. Not if you're wanting to use an SMG or an Assault rifle. You could argue the two weapons types that should be locked are Shotguns and Snipers. Those are always the outliers and the most annoying to play against.
For your example, a recon wouldn't use a sniper rifle if they were going to try and clear a building? Besides, real life doesn't apply to games very well, It's just a matter of balancing above all else.
Having unlocked weapons has zero effect on balancing. You can lock snipers to the recon class, but then people are just going to use that class in order to snipe. There's no magical way of solving this perceived issue, other than game design. Which includes map design, limiting long sight lines, giving generous xp for playing your role well, making weapons feel good to use and balance them, and this list goes on. It comes down to good game design. Locking weapons worked fine in the older titles, but it honestly feels like an antiquated game design for modern games. It's just unnecessarily annoying for players basically with no payoff.
It works for Hero shooters, but that's because kits are completely curated with no option to customize whatsoever, and those games are tightly balanced around that concept, Battlefield doesn't quite fit that.