The node you are looking for is at Contexts and engravers - Changing time signatures inside a polymetric section using \scaleDurations.