I think Tolkien meant the giants to be real in the Hobbit. The paragraph after then one you quoted starts with:
When [Bilbo] peeped out in the lightning flashes, he saw that across the valley the stone-giants were out, and were hurling rocks at one another for a game, and catching then, and tossing them down into the darkness where they smashed among the trees far below, or splintered into little bits with a bang...They could hear the giants guffawing and shouting all over the mountansides.
"This won't do at all!" said Thorin, "If we don't get blown off or drowned, or struck by lightning, we shall be picked up by some giant and kicked sky-high for a football."
After the party escapes the goblins and gets through the mountains, Gandalf suggests blocking up the entrance in the pass through which they had been ambushed:
"I must see if I can't find a more or less decent giant to block it up again," said Gandalf, "or soon there will be no getting over the mountains at all."
You shouldn't, at least not completely. The giants in the book are giants--very large humanoids. They are not mountains that transform into something else.
Tolkien never actually describes them, so we don't know if they're stone-giants because they live among the stones of the mountains, because they throw stones, or because they are made of stone. I actually pictured them as Pdonis describes them, as very large humanoids, although I can't be sure.
But I don't think we can definitively settle the question of the giants' form, as we simply don't have enough data. So I suggest we branch out to another unanswerable question: would Gandalf have used Emacs or Vim? How about Sauron?
Tolkien doesn't come right out and say "giants are very large humanoids", but so what? They are described as throwing stones, which clearly implies that they are humanoids. The "very large" part is implied by the word "giant"; also, of course, there are plenty of mythological references to giants, in particular in Norse mythology, which Tolkien is known to have drawn upon, and they're always very large humanoids.
When [Bilbo] peeped out in the lightning flashes, he saw that across the valley the stone-giants were out, and were hurling rocks at one another for a game, and catching then, and tossing them down into the darkness where they smashed among the trees far below, or splintered into little bits with a bang...They could hear the giants guffawing and shouting all over the mountansides.
"This won't do at all!" said Thorin, "If we don't get blown off or drowned, or struck by lightning, we shall be picked up by some giant and kicked sky-high for a football."
After the party escapes the goblins and gets through the mountains, Gandalf suggests blocking up the entrance in the pass through which they had been ambushed:
"I must see if I can't find a more or less decent giant to block it up again," said Gandalf, "or soon there will be no getting over the mountains at all."