Wake from sleep on button AND recognize which button was pressed

I have two buttons here (digital inputs on D2 and D3). When it’s sleeping you can press a button to wake it up. This is that simple, center rectangle.

Then I tried adding the delay circuit on the right (but without the transistor at the top) so that when you press the D3 button while it’s in sleep mode, the pin is held high for a few extra seconds while it wakes up, allowing the firmware to read the button press and take action.

This worked great! But now quick presses of the button are impossible since the cap debounces it a few seconds. So I tried adding the lower portion to disable the right circuit when the power was on. The firmware keeps D6 HIGH when it’s running, and LOW in sleep mode, then the inverter flips it. I added the top-most transistor to the delay circuit on the right to try to remove it when the D6 was high.

Does anyone see problems, conceptually with this? And if not, any specific bugs or misunderstandings?
I’m having a heck of a time getting this idea to work.

Here’s a clearer walkthrough of the steps:

  1. Wakes on press, but you can’t detect which button was pressed:

  2. Wakes on press, but also holds the D3 pin high so you can detect which button was pressed. Unfortunately quick presses of the button while it’s awake no longer work

  3. Try to disable the delay circuit when awake. I’m not sure what’s wrong here:

You could try a PNP transistor as your “inverting switch” with an external pull-down resistor for D6 as D6 will go hi-Z during sleep.

I tried replacing the inverter with a simple PNP transistor, and pulled D6 to ground but I’m still struggling. I feel like this must be an already-solved problem, and can’t be that uncommon.

Any ideas how to hold the button press on longer when waking, but bypass this behavior when it’s awake?