Retirement tax questions

So if that's the case, how does all of that fit into the ability to take a loan out? Effectively, I'm trying to skirt the maximum contribution limits by taking out a maximal ($50,000) loan and repaying it with interest, then rolling over everything into a Roth and traditional IRA, as appropriate. I reckon that if I max out my 401k contributions every year and also have the interest of a $50,000 loan getting paid back, then at the current 2022 limits and rates, I should have been able to contribute $61,000 ($20,500 employee contribution + $40,500 after-tax contribution) plus repay $12,000 (divided into principal + interest) of my loan, with that extra $2000 (=$12,000 payment - $50,000/5 years) being an amount I could not possibly have placed in my account without penalty through any other means -- in effect, if I took a $50,000 loan from my plan this year, I would be able (because my plan allows it) to contribute the max amount while repaying the loan, meaning at the end of 5 years I would have contributed the max amount each year, plus repaid my $50,000 with $10,000 interest. That $10,000 interest is extra money in my plan -- all I want to know is, when I roll that interest into an IRA, do any parameters of the loan (i.e., if the loan was taken from pre-tax, after-tax, Roth, or a mixture of funds) affect what I can roll that $10,000 into?