How is the percent-based gold production boost calculated?

Solution 1:

All percentage bonuses (not just gold) are based on the total raw output of the city.

So when the city makes 10 gold per turn from raw tile / building output, that 25% bonus gives you 2.5 gold. (You can never have fractional gold in your treasury, but if you have an additional source of fractional gold, it gets added together). When the city later makes 20 gold per turn (due to increased population, for instance), that same building provides a bonus of 5.0 gold instead!

So, "Option 2" in your proposed list is most akin to how the game works.