This feels a bit like metaphor foreshadowing. Right after this performance within the performance, Hamlet will use this same metaphor to Rosencrantz and Guildenstern. And its not like there are dozens upon dozens of pipe metaphors throughout Shakespeare. Hamlet, in a sense, seems to have given himself this idea for his pipe conversation with Rosencrantz and Guildenstern from this conversation with Horatio.
He (or Shakespeare, rather) is demonstrating this extraordinary thing that does happen in conversation – that ideas and thought can develop throughout the day. When I talk about the circus in the morning with one friend, several hours later while talking with another, I am very likely to use a circus metaphor I’m exploring. It would seem to be the viral quality of thought.