Can I loop two GPIO pins on an Arduino/ATmega328?
Debouncing idea is not good if you need use quadrature encoder. Even the max. theoretical frequency (counted from max. RPM) is low you can see high frequency flickering at one channel which is plus one, minus one, etc. When you miss some edge (e.g. handled by external interrupt), you see shift.
If you need count up/down pulses, you can reuse an external clock for two AVR counters. MCU supports some simple debouncing and bandwidth is high enough. It on-loads MCU as well. I found that evaluating quadrature A-B signals in code is useless, i.e. not reliable enough for high precision systems and rather using external quadrature counters LSI.

Some issues related to connecting two port are in AVR ATMega I/O pin overcurrent protection thread.