Matty, I totally get what you are saying.
I call it 'Intention'. There is an intention behind every thought we have and every thing we do. We might not be aware of it, but it is always there. And, trying to figure out the intention and facing it, like you did, is a huge step in self-awareness.