I attempted to replicate your set-up. Control as root of scene, Panel as child of Control, and HBoxContainer as child of Panel. Both Control and Panel are sect to "full rect" and "HBoxContainer" is set to "expand horizontal."
Visually, the panel occupies the entire viewport (as expected) and resizes when I resize the window. As far as I can tell, you observe that behavior too.
However, when I sample the rect_size of Control and Panel frame by frame, it gives me expected results (starts at the window size, then changes as I resize the window). I'm not sure what the issue is in your case--what property are you checking to determine the width of the window?
EDIT: I should note that I'm running on Godot 3.4.4, so that may make a difference. I don't know.