Generally, the structure is: [ "the" + noun1 + "of" + noun2 ], where noun1 is a type, and noun2 is a specific example of that type. Your example has a "wh" noun clause, but it's the same for any noun phrase at all, not just "wh"-clauses.
Here's how this function of "of" is described in Merriam-Webster:
of conjunction
8 a —used as a function word to indicate a particular example belonging to the class denoted by the preceding noun
the city of Rome
In M-W's example, "city" is the type or "class", and "Rome" is the specific instance of a city. You can say "the city of Rome", or you can say "Rome" without losing any information.
Similarly in your sentence, "the question" is the type or "class", and the noun phrase "when the money would be collected" is the specific instance of "question". And as with the "city of Rome" example, both the type noun and "of" can be omitted:
Juan raised* when the money would be collected.
It's worth noting that not all "type" nouns work with this "of" structure. So all these are all correct and natural:
the philosophy of stoicism
the religion of Judaism
the topic of unemployment
the issue of whether to reopen Main Street to car traffic
But all these are either meaningless, or "of" has a different meaning:
the footballer of Messi
the car company of Honda
the drink of beer
I don't know exactly what the rule is for which type-nouns work, but the more abstract the concept the more likely they'll work.
*Note: The meaning of this version is exactly the same as your original sentence but this phrasing is unnatural because "raised" almost always has some noun phrase like, "the question"/"the issue"/"the topic" etc. after it.