This has been talked about before and now I checked how it goes. Companions already make some checks when going through door thinking "Should I close it now?". Sometimes they do, but in most cases no. Why it's not done everytime is to avoid situations where eg. moving together with the player character they would slam the door close in front of players face. But as it's impossible to properly guess everytime how the door is preferred, closed or open, it would be safest to make companions shut it everytime they go through. However, in that case we'd sometimes be seeing several companions go through the door opening and closing it after each passing, and so on. Checks could be added endlessly, but it's not worthwhile to start making door handling simulator
so "close everytime you go through" rule for the companions is probably the simplest - and least annoying - solution.
To freeze companions when they or player character enters the building is not a good solution, and I'm sure it would only lead into more frustration.