And it refers you to Pub 575 for Timing of rollovers.
My point for the "loan" is, you were stating it as if the borrower benefited from the money, so the borrower (or his estate) should be reporting that as income and paying the tax. But it is not treated the same as forgiven debt (deemed distribution). This is treated the same as (Taxable) Actual Distribution. Distribution because, as part of closing out the account to the beneficiary, it was the amount of the missing component. It's more like: to close out the account, we'll pretend we gave you the full amount, some of which you used to repay the loan, and you get the Net as the beneficiary.
"Level Up" is a gaming function, not a real life function.