
This kind of thinking is conditional: If I’d been in x place at y time, I would’ve done z thing. There’s actually a name for this construction in grammar. It’s called the third conditional tense, and is explained thus: “The third conditional tense describes something that did not happen, but could have happened given the right conditions.”
Given the right conditions, we would’ve done the right thing.