you are into the low uA for discharge. When the capacitor is full the 10M resistor will try to unload as well. starting with 6v / 10M = 0.6uA. The input leak on the inverter is 1uA (small… but nearly 2 x higher). Next to that a capacitor has an internal resistance as well. When the inverter cuts off, I would expect the capacitor output voltage to increase, as the resistance divider changes (higher inverter resistance as the input transistor is cut off, less current flowing) and have a lesser voltage drop over the internal resistance. Why it worked on the breadboard and not on the circuit. ? not sure, but the smallest change in the resistor or capacitor values. Maybe the breadboard already has a different capacitor/ resistance as you mentioned or maybe because it was just heated up for soldering can already have a big impact. You could try to increase the capacitor and reduce the pull-down to act as the real discharger (instead of the inverter mainly doing that and get confused half way between off and on). You could also decide to bring an RC circuit after the inverter. A more radical approach is to replace the 7404 and build the inverter logic with a single transistor and some resistors.