Decline in the Value of the Domestic Currency
Your question appears to be just: why would they issue foreign currency debt?

If an emerging country is growing rapidly, it often attracts capital flows. This is typically associated with a strengthening currency. Firms and investors extrapolate this tendency, and so they lend to the country in the currency of a developed economy (typically the U.S. dollar). If the local currency continues to appreciate against the U.S. dollar, it should be easier to cover the payments (since local currency earnings are worth more). Things break down if this extrapolation fails, as discussed in the question.

In terms of an example, you could look at the developing Asian countries ahead of the Asian Crisis of 1997. Borrowing in U.S. dollars by local forms was the root of the problem. The post-1997 tendency to accumulate large foreign currency reserves by central banks in countries pursuing an export-led growth strategy was a reaction to that experience.