I expect this is a common problem,
Treasurer get loads on contributions in CSV format ( Contact ID / Amount / Date )
Bulk loading contributions via CSV is completely detached from membership renewal.
As memberships are set to go 'grace' on expiry I think a script like
Search membership in grace If contribution made and receipt date > membership expiry date set membership status to current , set expiry to end next period, link contribution to membership
I don't think this is too challenging in SQL ( I haven't looked at API ing it )
So now the question, there are batch jobs - how are they created / structured ?