Can a pushbutton be connected between a digital input and a digital output ?

If you consider the keypad.h library, that is exactly the case of output pins driving input pins.
Say there was a 4x4 matrix.
4 outputs, 4 inputs.
The outputs are normally high, the inputs have internal pullups connected.
To scan the keypad, 1 output is driven low, the 4 inputs are read - if a button is pressed, one input will read low. You know which output was low, you know which input was just read, so you know which button was pressed.
1st output is then driven back high, the 2nd output goes low, and the inputs are read again.
Same for output 3 and then 4.
Does that help?