You've misunderstood a couple of things, but i'll address the overall question first - Protection of the Raspberry Pi's GPIO from over-current conditions
The GPIO on the R-Pi can be subject to over-current conditions for multiple reasons, not just a start-up glitch where what should be a high-impedance (aka. resistance) input is an output instead, and could possibly be an output LOW meaning it's essentially a short-circuit to ground inside the R-PI.
As a general guideline for interfacing with ANY fancy logic/computer board like the R-Pi, CompactRIO, or pretty much any logic board that can have access to the outside world and doesn't already have its own ruggedized inputs/outputs (some boards do! always check datasheets/schematics to see how rugged they really are) you want to add some cheap protection yourself.
Typical external protection components are simply series resistors on every single GPIO in that interacts with the outside world or external voltage sources. So in this situation, a series 330 Ohm resistor between the R-Pi's GPIO pin and the rest of your circuits, as a middle-man.
The role of the series resistor is to prevent total current into, or out of, the pin to be limited and will never be able to 'short'.
The next major protection element people use to protect logic boards like these from the outside world is ESD and over-voltage (like TVS diodes) clamping diode arrays. Every single pin can benefit from having an ESD clamp from the pin to ground, to absorb static discharge events - and TVS diodes or zeners with additional resistors to allow permanent 'over voltage' situations without ever harming the logic boards on the other side of the circuit.
For your circuit you actually won't have the dangerous short-circuit condition on that pin, you have already got a pull-up resistor to the 3.3V rail which acts as the current limiting element. There is no other path to ground in your simple example to worry about, except maybe the IR sensor's output if that happens to have a proper high-current driver output (unlikely, it's most likely to be a variable resistance).
If you wanted to be super careful, and to follow the general guidelines I ranted on about earlier, you can do something like this (and add the resistor for every other GPIO which interfaces with the real world).

simulate this circuit – Schematic created using CircuitLab
With the 330 ohm resistor in there, the maximum input current to the GPIO pin if it was accidentally set to OUTPUT and LOW, assuming a 3.3V rail is connected directly to the input (but we still have the resistor there!) for whatever reason, then the maximum current will be only 10mA (3.3V/330R= 0.01A).