a) Max out to the permissible level of all my available buildings before I upgrade to next age or level
To provide a general answer - this is a bad idea. This strategy requires more resources and more time, obviously. Not all upgrades are needed or required, and/or can be researched at a later point. You can even research when your town centre is advancing.
This will depend on your strategy. I mean, why upgrade pikemen if you never train them?
b) Immediately upgrade when the option is made available
This is often the case. However, I would consider other town centre functions before hitting the advance button. For example, do you have enough villagers? In later ages you can build multiple town centres so it isn't really a problem (i.e. you can advance off one town centre, and train/research through another).
Is there a general rule for this? Are there other things to consider?
To expand on "depending on your strategy" - every civilisation is different. Every map type is different (online/multiplayer). Every campaign level is different. However, to provide a general rule I would say advance as early as possible but don't sacrifice your town centre's other functions (mainly, training enough villagers). It is one thing to advance to the second age quickly, but if you arrive in the age with a weak economy you may never see the third age. This will mean you need to prioritise your research goals (maybe differentiate between "must have" and "nice to have" as well as "not required").