The throttle is either open or there is a major hole/leak between it and the UIM.
That is the only reason it would rev to redline.
The TPS only lets the PCM know where the "throttle" is "positioned".
Without air actually going into the UIM the engine would not race.