Jeremiah speaks a hard word to the nation of Israel—Here is your choice, he said, you can fight the Babylonians and die, or obey the Lord: submit to your invaders, allow them to carry you away from your homeland and serve them as slaves. In other words, Jeremiah tells the people to realize the futility of the fight, return to the Lord and resign to the fact that to live, to make sure Israel would have a future, they had to lose their freedom. The Lord promises if they did not resist, He would restore Israel, bringing a remnant back from exile.
Now the two stories are not nearly the same. The little girl had only lost a hat; Israel was losing their national identity, their homeland, their freedom, and that doesn't even begin to describe the horrors of their loss. One girl vs a whole nation of men, women, sons and daughters. The girl didn't really think she would get her hat back, and in the scope of things, it wasn't all that important. However, the Lord was asking the people of Israel to have faith that He would be their hope while they were in exile. He would secure the nation's future if they hoped in Him, and their faith was imperative to the restoration of God's people.
But here's the kicker: the generation sent into exile would not see the restoration in their lifetime. Neither would the next. It would be 70 years before the Lord freed Israel from their captors and brought them home. The Lord was asking them to have faith, not to be free from pain but through the pain--faith that went beyond their own individual lives for the good of their people. He was asking them to be willing to suffer slavery under the Babylonians, what many would consider a fate worse than death, for the future of their nation. Still, He wasn't asking them to go alone and He would not forsake them.
To resign to the futility of the fight goes against our senses, but remember that our "sense" of things is faulty; obedience to the Spirit is sure. Sometimes standing firm in the faith means surrender. But surrender with hope, and trust in the Lord who will never leave you nor forsake you.