In the diagram, the "buffer" you have labeled G2DB that "disconnects" PINx from the actual pin when DDRx is low? That doesn't actually exist! PINx is always connected to the actual pin, regardless of the state of DDRx.
My understanding appeared from the traditional meaning of pinMode(2, INPUT) function. When pinMode(2, OUTPUT) makes the line output, the pinMode(2, INPUT) must make the line input. In this case, there should be an isolation, and that's why I added the 3-state device - G2DB. Moreover, a pin cannot simultaneously work as input and output. Thanks for re-posting the actual pin structure diagram from the data sheets, which has removed my misconception.
Now, the meaning of pinMode(2, INPUT) appears as: It does not do anything with line direction; it essentially disconnects the output buffer (G2DA) from the input line when DPin-2 is intended to be used as input line. The function also opens the way of enabling the internal pull-up via the PUD-bit. (pinMode(2, INPUT_PULLUP)).
(There is no Arduino function that ever reads PORTx.)
Assume that DPin-2 is configured to work as output, and it is directly connected (experimental setup) to the base of a transistorized load of the following circuit. I wish to toggle the states of LED2. The execution of the instruction digitalWrite(2, !digitalRead(2)) will never toggle the states of LED2 as digitalRead(2) reads the PIND2 and not the PD2. Reading PIND2 will always provide LL (assume Q1 was made ON last time), which after inversion becomes LH; it goes to transistor base; the transistor remains ON; LED2 does not change its states. Am I correct?
To toggle the states of the load, I must execute the following instructions (they work!).
bool n = bitRead(PORTD, 2); //it reads PD2
n = !n;
bitWrite(PORTD, 2, n);