Could Sauron have been behind the attack on Erebor?
Doubtful; we're told in The Hobbit what motivated the attack by the goblins, and it was pretty clearly a mixture of greed and revenge:
Ever since the fall of the Great Goblin of the Misty Mountains the hatred of their race for the dwarves had been rekindled to fury. Messengers had passed to and fro between all their cities, colonies and strongholds; for they resolved now to win the dominion of the North. Tidings they had gathered in secret ways; and in all the mountains there was a forging and an arming. Then they marched and gathered by hill and valley, going ever by tunnel or under dark, until around and beneath the great mountain Gundabad of the North, where was their capital, a vast host was assembled ready to sweep down in time of storm unawares upon the South. Then they learned of the death of Smaug, and joy was in their hearts
The Hobbit Chapter 17: "The Clouds Burst"
It's not impossible for Sauron to have inserted himself into this intelligence network and influence the decision that was made, but it's pretty clear that he at least didn't order the attack.
What is Frodo1 trying to say with that quote?
Let's take a look at that last quote (from the question) in a broader context:
But alas! Thorin did not live to enjoy his triumph or his treasure. Pride and greed overcame him in spite of my [Gandalf's] warning."
"But surely," I said, "he might have fallen in battle anyway? There would have been an attack of Orcs, however generous Thorin had been with his treasure."
Unfinished Tales Part 3: "The Third Age" Chapter III: "The Quest of Erebor"
From the context, it's clear that Sauron doesn't enter into this discussion at all; Gandalf and Frodo are discussing the climax of The Hobbit, the Battle of the Five Armies:
Gandalf laments that Thorin was killed by his own greed and stubbornness; he calls back to a statement from earlier in the text:
[C]urb your pride and your greed, or you will fall at the end of whatever path you take, though your hands be full of gold.
Unfinished Tales Part 3: "The Third Age" Chapter III: "The Quest of Erebor"
- Thorin's pride and greed are, of course, the things that most annoy the Elves of Mirkwood and the Men of Dale, and lead to the Siege of Erebor that preceded the Battle of Five Armies
Frodo remarks that Thorin probably still would have died, even if he'd been less greedy
- His point is that Thorin could have avoided the Siege of Erebor by giving a small portion of his (enormous) treasure to the Elves and/or the Men of Dale, but he couldn't have prevented the Goblins from attacking; regardless of Thorin's greed, the Battle of Five Armies was inevitable
1 It is indeed Frodo speaking; the quote begins:
"But surely," I said, "he might have fallen in battle anyway? There would have been an attack of Orcs, however generous Thorin had been with his treasure."
Unfinished Tales Part 3: "The Third Age" Chapter III: "The Quest of Erebor"
And Christopher Tolkien's commentary opening the chapter disambiguates the pronouns:
The "He" of the opening sentence is Gandalf, "we" are Frodo, Peregrin, Meriadoc, and Gimli, and "I" is Frodo, the recorder of the conversation
Unfinished Tales Part 3: "The Third Age" Chapter III: "The Quest of Erebor"