In my view, one of the traditional roles of central banks has been to serve as "fiscal agent" of the government, and managing the national debt is one aspect of that role. "Lender of last resort," on the other hand, involves lending to banks, rather than to the government.
In my view, the role of the central bank/monetary authority should be to adjust the quantity of base money to accommodate any change in the demand to hold it. Base money is made up hand-to-hand currency issued by the central bank and reserve balances that banks hold with the central bank.
Members of the nonbanking public, households and firms other than banks, obtain hand-to-hand currency through banks. The demand for that part of base money often manifests as deposits or withdrawals of currency from banks. And it is banks themselves that demand reserve balances. The demand to hold base money is closely related to the banking industry. Perhaps the more fundamental reason is that banks borrow through issuing monetary liabilities, financial instruments like checkable deposits, that are close substitutes for base money.
The ordinary process of payments results in withdrawals and deposits of currency and the deposit and clearing of checks. This results in changes reserve balances at different banks--banks with adverse net clearings lose reserves to banks with favorable net clearings. Banks with adverse clearings can borrow from banks with favorable clearings, shifting reserves and currency to where it is needed. In an economy with liquid financial assets, straight sales and purchases of securities can serve the same purpose. Often, short term lending between banks is secured by relatively liquid securities, with repurchase agreements formalizing this hybrid between security transactions and lending.
If, on the other hand, there is an increased demand for base money, either currency or reserve balances, borrowing and lending between banks becomes imbalanced. For example, an increase in the demand for currency results in a withdrawal of currency from some banks that is not matched by additional deposits in other banks. Similarly, if a bank chooses to hold larger reserve balances, it can sell off securities or restrict new lending. Other banks will suffer the balancing reserve deficiencies, but the usual practice of borrowing to meet temporary imbalances doesn't work because the bank accumulating the reserves does not want to lend.
Because the central bank/monetary authority has a monopoly on the creation of base money, it is the only one able to accommodate this increase demand for its "product." Because these demands for base money often show up through the banking system as a demand to borrow without a matching supply of base money to lend, meeting the demand for base money involves serving as "lender of last resort."
In the situation of a bank run, or even a prospective bank run, where many banks seek to accumulate reserve balances to pay out if the run does materialize, the added demand for base money is large, and the consequences of a failure to meet this additional demand can be catastrophic. The market process that eventually returns the economy to equilibrium requires a reduction in the price level, including resources prices like wages. The real quantity of base money rises to meet the demand. While this could occur instantly (leaving aside the near impossibility of conceiving of a smooth and instant resolution of defaults caused by the transfer of wealth from debtors to creditors,) in reality, putting the economy through a deflationary wringer results in unnecessary disruptions in production and employment. Having the central bank/monetary authority serve as "lender of last resort" seems like an essential practice.
What exactly does this have to do with a government that needs to borrow? Generally, governments are not borrowing to accumulate base money, much less to meet the demands for base money by the public. Governments are borrowing to spend. Serving as "lender of last resort" to the government isn't about accommodating an increase in the demand to hold base money, but rather printing up money for the government to spend.
It is true that governments that borrow short to fund a large national debt must constantly borrow to repay debt as it comes due. If lenders loose confidence in the government's ability or willingness to repay, then they will stop lending. The government cannot repay debt as it comes due, and defaults.
Banks are in a similar situation in that their liabilities come due frequently, and banks must borrow again to repay these debts. With monetary liabilities issued by banks the process is more or less continuous. If depositors lose confidence in the ability (willingness is less of an issue with banks bound by contract to redeem in base money,) of banks to repay, then they will no longer lend. The bank defaults.
If, from the economist's God's eye point of view, the bank is really solvent, then going through the costs associated with default is a waste. Similarly, if General Motors is really a sound business, going through reorganization would be a waste, and government planners should fund the business. If the government as a whole really is able and willing to repay its debts, then someone should lend to the government to avoid the wasteful disruption caused by default.
In my view, there is no "God's eye" point of view, and when lenders lose confidence, default and bankruptcy is the proper response. For governments, this means giving existing creditors new bonds to replace the old bond at whatever interest rate the government believes it can pay, and bringing current expenditures in line with current receipts.
Similarly, while the monetary authority/central bank should always accommodate changes in the demand to hold base money, if depositors loose confidence in a bank, then it should be reorganized. With a very concentrated banking system, the loss of even a single large bank could be very disruptive. And it is also possible that many banks could have similar problems at the same time, leading to a loss of confidence by depositors, independent of an increase in the demand to hold base money. An increase in the demand to hold base money, not accommodated by an increase in the quantity of base money, will almost certainly cause difficulties for all banks. But it has become apparent that many banks can get into difficulty by treating sovereign debt or mortgages as if they are (nearly) risk free. Provisions for a rapid reorganization of many banks is important.
In my view, having a central bank/monetary authority create money because someone needs to borrow, is a mistake. "Lender of last resort" is the wrong perspective. Supplying the quantity of base money demanded is the proper role of a central bank/monetary authority.