The valour bonuses do work pretty much as you say If a unit requires the "v1" building (eg bowyer) then it will have a +1 bonus in the "v2" building (eg bowyer's workshop).

Where two building lines are required, then the one listed first in the unit_prod entry is the one that gives the valour bonus. So if you had a unit needing a swordsmith and spearmaker, you could set the valour bonus to come from either building: for a swordsmith-line bonus you would enter (swordsmith, spearmaker) and reversing this would give the bonus from the spearmaker line.

The exception to this is for cavalry, where the horse breeder line always gives the valour bonus.

The happiness bonuses do work on a "replacement" basis when a building is upgraded, but where different building types are available they should be cumulative. So church replaces chapel, but a cathedral is extra