Can I use treasure to pay for a counterspell?
Yes, you can do this, for 2 different reasons.

First, as mentioned in Drunk Cynic's answer, treasure tokens' activated abilities are mana abilities, just like tapping a land for mana is.


  605.1a An activated ability is a mana ability if it meets all of the following criteria: it doesn’t have a target, it could add mana to a player’s mana pool when it resolves, and it’s not a loyalty ability. (See rule 606, “Loyalty Abilities.”)


But also, you seem to be incorrectly thinking that once the stack begins to resolve, it finishes resolving all the way. This is not the case.

Each player gets priority after each thing on the stack resolves. This means that even if your only way of getting mana was from something other than a mana abiltiy (such as needing to activate an ability that would get you treasure tokens), you could still do that.


  116.3b The active player receives priority after a spell or ability (other than a mana ability) resolves.


So you could activate a non-mana ability that gets you mana in some way, then when that resolve, you can then cast your counterspell, while the spell you are still trying to counter resolves.