I think you are confusing message loops with window procedures. In a simple example like yours, messages for all of the windows that are created by a thread are dispatched by a single message loop. The dispatched messages are routed by Windows to the window procedure for the related window.
The parent and child windows have their own window procedures, and a single message loop dispatches messages to them.
Read more at messages-and-message-queues