Why do I first need to set a value and then direction of the GPIO in an embedded processor?
The original 8051 used so-called pseudo-bidirectional output ports (open-drain with pullups), so there was really no port direction setting. 

Of course for modern true bidirectional output ports it's better to have a known value set before enabling the port pin for output, because otherwise you could have a transient on the output that could do something undesirable. 

See my answer here, for example. 

Edit: Here is the I/O pin structure for a (relatively) modern CMOS microcontroller: 



TRIS (TRIState) is called DDR (Data Direction Register) in many other micros. In this case, if the TRIS latch output is high then both transistors are 'off', but the port can still be read.

Here is a slightly more complex I/O pin structure for a newer Microchip micro. 



Again, the TRIS latch disables the output. This one includes a LAT latch that helps avoid read-modify-write issues. On the PIC series you should write to the LAT register only (and read from the PORT register). 

Here is the original 8051 and CMOS 8051 classic I/O port pin internal circuitry (from this source): 



There's a bit of extra complexity in that there is a speed-up transistor in parallel with the pull-up that is briefly turned on to overcome external capacitance. As you can see, there is no TRIS/DDR control at all. The pull-up MOSFETs used in normal operation are 'weak'- they are small enough (low Idss) that an external output connected to the pin can pull the pseudo-bidirectional port line low.