Why do I need to make an intermediate step on switching a pin from input to output On Atmega328p microcontroller?
In general this is not a &quot;you must&quot; requirement but a reminder of the fact that the processor can only update one register at a time.
On the ATmega series, the input vs. output and the output value or pull-up are controlled by distinct registers with a bit per pin, and the processor can only modify one register at a time, so for any change which requires modifying both aspects of a given pin, there exists a brief instant in time when one aspect has been updated and the other has not.
What the paragraph does is discuss strategy for what order to modify the two registers in.  The chip itself isn't imposing an answer, but external circuitry might care.  The possibility is raised of going through additional steps to create a safe sequence of change.  But the requirement for a specific sequence comes from the needs of external circuitry, not the processor itself.
As a more general rule, one should be careful to make sure that the output level a drive will drive at is appropriate (or at least acceptable) before enabling the driver.   The paragraph discusses the complications arising from the controls being split over multiple bits and the output data register being re-used as a pullup control; hence the consequence are different than in chips which may use a pair of bits in the same register to control both direction and pull-up, and keep that distinct from an output data register which has no differing function in input mode.
If one is not switching repeatedly between input and output modes while needing to maintain a given glitch-free state on a shared wire, this is likely of little concern.  In many of the typical places where one would be (bit-bang I2C or multi-drop serial) idle-high paradigms with external pull-ups make it fairly safe to set the data register before setting the direction register.