The game has many issues when it comes to lock on, movement and camera, but the one thing it doesn’t do is randomly swap targets on you.
Theirs two types of lock on, their’s the soft lock on which isn’t really a lock on, but you get a small orange circle which indicates what you are targeting, and can swap very quickly if either you or the enemy is moving.
Theirs also the hard lock on, which is a lock on I have to use LB to activate. Once I have a lock on it won’t break or change unless I try to lock on to another target, manually swap target, a part breaks on the enemy, or the enemy does something to break the lock on like teleporting. If you’re playing on controller you can swap targets using the right stick, so if you’re trying to use the right stick to adjust the camera, which you can’t with a hard lock on, then you’re likely without meaning to changing the target, making it fee like it’s swapping randomly