CK3 levies/taxes from vassals of vassals
Solution 1:
Taxes and Levies from a vassal's vassals are already factored in.
If your vassal has 100 levies, you'll get 25% of it -- it doesn't matter if those 100 come from a half-dozen different mayors and cities.
Source is irrelevant, the numeric value (and resultant percent) is all that matters. Put another way, the calculation is only done on your direct vassals, and because Levies don't represent individuals, it's consistent to abstract them in this way.