This may end up being somewhat circular, but we have a good credit rating because there is a degree of restraint in government borrowing. Borrowing by the ROSCOs is off the balance sheet so doesn’t count. Similarly, the explosion in use of PFI under Blair allowed investment without breaking the EU rules on member states budget deficits and debt to GDP ratio.
I"m glad you've bought up the topic of PFI, it has widely been regarded as an expensive and ineffective mistake. Perhaps we might have finally found an advantage of Brexit!
I would suggest that our credit rating is not due to the total scale of our borrowing, but due to the type of borrowing. Borrowing to fund day-to-day expenses is generally considered unwise, and leads to inflationary issues such as those seen in places such as Zimbabwe. However borrowing to invest, either in new projects that will return more money to the taxpayer than they cost, or in restructuring the cost of existing financial obligations to make them more cost-effective, as would be the case with nationalizing rolling-stock, are typically well received, as they put government finances in a better longer-term position.
What matters for creditworthyness is the relative size of the nations incomings and outgoings, and the idea that the worlds leading financial institutions cannot see the use of for-profit private finance for rolling stock as what it is, an expensive accounting trick.