There were untold ways for God to do this. One, instead of taking back the plates he could have allowed Smith to sell them to a museum or have them melted down or something. They ain't doin' any good in heaven.
The other idea is softening the hearts of those owed money. In fact, God promised to do that in the D&C.
D&C 104:80 And inasmuch as you are diligent and humble, and exercise the prayer of faith, behold, I will soften the hearts of those to whom you are in debt, until I shall send means unto you for your deliverance.
Why didn't God follow through with his promise?
Why didn't God make a way for Joseph Smith to pay his debts rather than file bankruptcy?