The building of two districts should be considered as two separate action or as one comprehensive action?
Tax Collector collects immediately after each one, as per the text you quote.

(Note: there may be at least one version of the rules whose section for the Tax Collector reads "one or more" and "at the end of the turn" instead. EDIT: found it: the original 2004 Dark City Expansion version said "If a player builds one or more districts in his city, that player must give you 1 gold at the end of his turn."  According to this BGG post , the Tax Collector was the only character whose card text changed in the 2016 edition ).