Just a couple of other thoughts on ways to deal with this:
If you have the ports and pins, you can just use separate ports for each direction. The Apple 1 worked this way, using one port of the 6820 for ouptut to the video subsystem and the other port to read the keyboard. In the
RC6502 Apple I clone SBC an MCP23S17 I/O expander is added to give the microcontroller that emulates the keyboard and video subsystems plenty more I/O lines.
For safer bidirectional communication on shared I/O lines, you could put pull-ups on the lines (or use internal pull-ups in the PIA or microcontroller) to hold them high by default and use only open-collector connections to them, ensuring that if more than one party tries to "talk" at the same time they're both just sinking currents from the pull-ups and doing no harm to each other or anybody else. This is how the Commodore serial bus used for VIC-20 and C64 drives and other peripherals works.
Bidirectional communications requires some sort of protocol of course, and
the Commodore one is not simple. (I don't know if it's really possibly to do this simply.) So if you decide to proceed down the bidirectional path, you should keep in mind that there's always the two-channel option in case things get too complex and annoying.