In any case, it wouldn't actually be necessary to calculate LOS all the time for this. Just have a dwarf do one quick check at key points in their room -- waking up and going to sleep. This is logical; dwarves probably won't mind as much if visitors pass through while they're up, but most people would be annoyed by people constantly there when you're trying to sleep.
And of course we only care about who the dwarf can see, not who can see the dwarf (if they don't know, they don't get an unhappy thought.) So it's only for individual dwarves at comparatively rare intervals, not a constant check-every-step thing.
And, aside from noise, dwarves logically won't notice people passing through when they are asleep.
Similar things could be done with other rooms if you want dwarves to desire privacy for them, although I'm not sure that's always needed. Basically, just check LOS whenever you start a new job in the room
Actually, though, do we really want this? Suppose I have a room with a window -- will that make my dwarf upset? With an LOS check, it would.
It can be kind of hard to look at cases like these and envision all the various room layouts a dwarf could have. What if I have a room built into a cliff, open to the air in the side? That seems like a nice thing in some ways -- will the dwarf get angry if they can see people down below?
I think the window issue is fine: The LOS check would have a limited distance (maybe 10 tiles?). If your bedroom window opens out directly onto the crowded communal statue garden you'd be pretty unhappy about it, but if it opens out onto a bottomless pit you won't need to care about the dwarves on the opposite rim (DF is not
a Hitchcock film and there are no binoculars). The check might also only consider dwarves on the same z-level to make cliffside bedrooms practical (there are no peeping-Ursists to go looking into second floor windows).
I still think the issue of people passing through your private room should be addressed
in addition to the LOS check when going to sleep and changing clothes. This would be to address the "personal space" issue: things like strange footprints, messed up personal belongings, etc. If theft is implemented, then having closed doors and other security related stuff would add value by limiting the amount they can get in to mess with your stuff (actually having them steal things would be an additional negative thought, but rummaged drawers are sure to be upsetting even if nothing is taken). The fortress guard might detain anyone seen opening a door to somebody else's room when doing a "steal stuff" job (this would be another LOS check, but one only performed when the breaking and entering was taking place).
I don't think exceptions to the privacy checks need to be made for construction workers either. Anyone who's had workers in their house when they're away can probably understand why I think so: they inevitably disrupt things, even if they're trying to be respectful of your property (and just imagine the fun that could come from a kleptomaniac engraver or a lazy furniture hauler who decides to take a quick nap on your bed after delivering your new coffer). Having a random mason wander into your bedroom to pick up some stone shouldn't be pleasant either (and it would be more incentive to clear the scrap rock out rooms before dwarves move in).
There is always matter of degree to the unhappiness, of course, so I don't think dwarves should be tantruming over privacy, though it might be the straw that breaks an already miserable dwarf's emotional back. It might be best to actually think of it the other way, and give a happy though if the dwarf has private space and secure belongings (where "private" and "secure" are defined by the lack of privacy invasions over some period of time).