The path on which Bilbo, Gandalf, and the dwarves travel is a very important element in the story. The concept is similar to the "follow the yellow brick road" idea in the movie The Wizard of Oz. Whenever the group steps off the path, even if it's for a split second, something bad happens to them. For example, they met the evil trolls when the saw a light in the distance and left the path. When they were captured by the goblins, they had left the path to take shelter from the thunderstorm in a cave. When they stay on the path, they safely reach their destination. When they stayed on the path, they found their way to the elves' house in the woods, where the wise wizard discovered the secret moon-letters in the map, which were vital to finding the treasure. The path is the constant in the novel; it is always there and therefore it is reassuring.
The reader knows that Bilbo will mature over the course of the novel. He is now thirty years old, but he is still a child because Hobbits live for about five hundred years. He has never experienced any change whatsoever from his normal, boring, everyday life, so he has not matured yet. At the end of Chapter Seven, Gandalf leaves the group, saying that he has business elsewhere to take care of. I think that he just left them as a favor to Bilbo, so that Bilbo will be able to mature. Gandalf acts as the parent in the situation; he is the leader. When he leaves, the parental role is empty and Bilbo will fill it in. In order for Bilbo to mature during this adventure, Gandalf simply had to leave, even though his absence puts the group in more danger.