As you discovered, the S&P index returns, if calculated just by looking at the index year on year, do not account for dividends. It only goes back to 1988, but ^SP500TR can be useful for what you seek.
I'd add to your idea of treating the index as if it were a stock, an S&P unit or share. Each year, don't adjust the index, adjust the number of units. ...
Use can use the NPER function to calculate the number of periods until payoff given a constant payment amount:
NPER 10.23557252 =NPER(5%/12,100,-1000)
Note that if you divide the APR by 12 to get a monthly rate, NPER will give you the number of months until payoff.
The goal should be to minimize the amount of interest paid, not necessarily the rate. To do this, pay the most to the loans with the highest rate first (regardless of balance). That reduces the principal on those loans more, reducing the amount of interest that is charged.
You also reduce the interest paid by paying more than the minimum amount. In fact, ...
Is it just to aim for the highest interest rates regardless of total balance outstanding?
Yes. It's really that simple: pay off the loans in order of interest (highest first).
This assumes that there are no other differences between the loans (forbearance, chance of loan forgiveness, pre-payment penalties or rewards, etc.)
This doesn't look like a wash sale. The cost basis for the 300 shares is $99.33 per share. Selling them at $102 yields $2.67 profit per share. Your capital gains for all that is $800 profit.
Buying all 300 shares back at $96 is the start of a new position. No wash sale here.