1990 Toyota 4Runner not starting when it is hot outside

I’ve got a friend with a 1990 Toyota 4Runner Manual transmission with ~170k miles on the clock. He’s been having an issue for quite some time that he hasn’t been able to be resolved. Basically he’s got an issue with the vehicle erratically NOT starting when it is hot outside. The vehicle starts fine when it is cold outside, but when it is hot he erratically (only happens sometimes) get a “click” noise from the engine compartment with no engine turn over or anything. He is then at the mercy of the vehicle and sometimes just has to try multiple times or wait it out for awhile and try again. Sometimes just opening the hood, looking around a minute, closing it, and re-trying is able to get it to start, but other times not. Other times, and I quote from him, “sometimes i just get really upset and stomp on the clutch, get out of the truck and just shake/rock it, sometimes that’ll do it.” It happens if the engine is cold or hot, it only matters that it is hot outside, above ~90 degrees. Anyone have any ideas as to what might be the issue? Below is a list of stuff that has been done to try and resolve the issue, but hasn’t really worked.

Steps taken
Replace Battery
Replaced the Alternator 2 years ago
Replaced the Battery Connectors (some were corroded)
Possible Starter Replacement within the past 5 years (double checking paperwork)
Rewired jumper wire from battery to starter

Seems sensor or solenoid related to me, but I’m unfamiliar with this vehicle/quirks and was wondering if anyone may have any ideas! Let me (us) know!

Next time it doesn’t start, get a piece of wood, put one end on the starter. Whack the other end of wood with a shoe or with a hammer while you have someone start it.
It may start now.

Changes are it is your starter as they do go bad from time to time but check connections to it from the battery - that big fat wire to the starter may be suspect. You say they rewired it - why? It could be the problem.
That ‘click’ you hear is most likely the relay on top of the starter. That means it is getting a signal to start so it most likely is not the transmission interlock, ignition switch, etc.

The starter was indeed replaced in January of last year, so I don’t see how it could be going bad so quick. My understanding is they replaced the wire to try and alleviate the issue, but it hasn’t helped (it happened before the wire was replaced)

The first thing I’d want to find out is if the starter assembly is indeed seeing 12VDC when the key is in START. I’d also want to verify that the “click” is indeed coming from the starter assembly. It should be on the solenoid portion. I’d also want to verify that the starter cable connections and the engine’s ground strap connections are corrosion free and well connected.

If the starter motor is indeed getting 12 VDC with the key in START and when it’s not starting, and if the solenoid assembly is clicking, than either (1) the electrical contactsin the bendix assembly that allow the battery to directly connect to the starter motor are making poor contact,(2) the windings in the starter motor are opening up when hot (I’m confident in assuming that he put in a rebuilt starter…?) or (3) the starter motor gear is not properly engaging with the flywheel. (3) would mean that the starter motor gears were unable to properly mesh and were preventing the starter motor gear from sliding in, but if that were happening I’d suspect it would be regardless of the outside temp.

It’s also possible that those battery connectors that were corroded are corroded again…have you rechecked those?