None of these tricks work. Whenever you turn on the game or zone, settlers can spawn anywhere, even on the top of Red Rocket. Also, doing things like removing stairs doesn't work either, for the same reason. I would just store the stairs to my treehouse in the workshop while I was out, so the entrance was about 40 feet up. Still get people in there when I come back.
My solution was to build a *lot* of beds, and a bar. The settlers and companions tend to congregate at the bar after work, and then hit beds close to it after getting hammered on Dirty Wastelanders. As long as the entrance to your house is beyond a lot of bed choices, they won't wander to yours. At least, they haven't yet.
Also, if you just moved the various workbenches rather than build new ones, they will come into your house to "use" them, and go to sleep in the nearest bed at bedtime. Since I figured all this out I almost never get people in my bedroom, unless I want them there. (I think the "lover's embrace perk should increase geometrically based on a larger n, but until we get double beds...)
Until we get console mods, or a dlc that addresses it, try these.