I guess it is logical in a way that if gates and doors are kept open and not locked, it can happen that strangers just walk right in. For me it has happened that strangers have walked in for a glass of water and then left again. This has led to that I have started to use the lock for everyone but household members function, which works fine. Although I need to have at least one more door, for example a backdoor locked for everyone but employees too so that the maid and nanny can come and leave. This works fine with one exception, invited visitors. If a sim invites a relative or a friend, that person can't get in unless I actively unlock the door, which is a hassle and during that time a stranger might sneak in as well. The best solution would be if the door had the option 'lock for everyone but household members and invited guests'. With such an option on one door and the employee function on another door, it would work perfectly but it also means that the game must tell between an invited guest and a stranger or uninvited friend. The invite itself should be the trigger to let the sim in I guess.
There is a couple of other problems around the lock function that needs to be solved as well. The gates of your fence should be locked for all pets, to not let in stray/neighbour pets and to not let your own pets out, at the same time as the gate should let in all persons in the household, employees, visitors, guests and maybe strangers (I assume a stranger should have a right to knock on the door), right. So the lock for all pets is the only reasonable option to choose for gates unless you want to lock people out of your garden. I have set the lock for all pets function on my gate and ended up with a starving, dirty, miserable pet outside the fence, who can't get in to his own household. The reason for that is that if a sim has aged up or anything else which has made them restart and stand outside the lot, then they all have walked through the gate, but the pet has not been able to as it's locked for pets. The best would be if age ups etc. never made the sims restart and stand outside of the fence on the border of the lot, but remain on the inside of the lot. The second best would be to make the lock for pets function work only from the inside of the gate, so that the pet is locked in but if the pet happens to end up on the outside of the gate, still can get in. Thus a get in but never out lock function for pets. If the lock functions were optimised to work like this it would be great.
Another problem is locked doors in relation to the butler. I don't like that the butler can use whichever bathroom in a house to take a bath or use the toilet. I usually give the butler his own bedroom and bathroom. So if I lock all other bathrooms for everyone but household members and keep one bathroom locked for everyone but butler, it works fine with one exception, the butler can neither clean nor repair the equipment in the bathrooms that are locked for him. The maid should also be able to clean inside of locked rooms, after knocking maybe 🙂. But perhaps a fix for this is a bit much to ask for.