How to autoregulate a TP4056 for maximum solar power extraction
I have been looking at the same question lately.  My solution was a bit different than yours:



By selecting D10, D11, D12 to be either OUTPUT/LOW or INPUT (High-Z, no pullup) I can vary Rprog from 16k (D10/11/12 all High-Z) down to 1050 Ohm (D10/11/12 all LOW)
and via A0 monitor the charging current to find the MPP.

The funny thing is, that from all my testing, I found that the TP4056 seems to do MPPT itself, i.e. even if you set Rprog too low, Vprog seems to autoregulate itself to keep the current at MPP.  So that would mean that just setting Rprog to the max current the solar panels can provide would be all that's needed.

BTW this confirms my empiric finding, having used simple TP4056 modules with my foldable solar panels without any problems for the last 2 years.  (It's a bit disappointing though, since I took all the trouble constructing my Arduino MPPT just to find out that I don't really need it ...)