I’m not sure if this is a bug or not but here goes. (This is intended behavior).
I was playing on Lock and Load, and my ally, a mengsk, dropped a supply bunker, filled with Troopers next to the lock. My banes and scourge were there, however, the lock wasn’t reacting when Megnsk’s troopers were in the bunker–only when they exited out of the bunker, did the lock start reacting to both of our armies.
Shouldn’t the locks check if a unit is in a bunker when it’s in the vicinity of a lock? No enemies were contesting the lock, mind you
Units in a building are registered as the building only, not units.
If you are asking about game features, then as FearrWhalins mentioned, it is an intended behaviour. This is also why you cannot just bring a Probe to build Pylons on it; or you can’t build Rax, lift them and land on the locks.
If you are coming from a “logically-it-should-be-this-way” POV, then it is more of a suggestion that you’d prefer. I can’t really comment much on it since everyone has different opinions on how the game should / should not function.