This is a good one and a bit tricky.
First, if it's a 2.7l with a normal distributor the first thing you want to check is your "air gap" internal to the distributor. The following link will really help.
Help! Code P0336 is got me stumped | Toyota Tacoma Forum
Basically the ECM is detecting a mis match on startup between the crank, cam, distributor(air gap), and distributor(firing) sensors.
Putting your foot into the throttle a bit (1500rpm for 10secs works) is a manual request to the ECM to bypass a mis matched signal shutdown and to proceed with startup(running).
This problem typically rears it's ugly head when someone goes in to changout a leaking distributor "O" ring. The distributor is not put in exactly the same way (almost impossible if high mileage) and walla you've got a P0336. Nuts.
Replacing with a factory distributor is not a definitive fix as the other sensors need to line up for what the ECU wants for startup signal match.
If there is high mileage it could be any of the above with possible inclusion of a slightly stretched timing chain.
Start with the distributor air gap and proceed from there.
I ran my '96 with this condition for years no harm no foul. Chalked it up to built in theft deterrent. There's a big difference what your willing to fix and not fix depending if your able to source parts at wholesale vs retail.