Building upon How to hook on customizer section expanded/active/opened event? question, perhaps you could listen for the section (or panel) expanding like this to unbind functions from the previuos section and bind them to the current section.
(function ( api ) {
// Wait for Customizer to be ready
api.bind( 'ready', function() {
// "cache"
var currentPanel,
currentSection;
// Listen for panel expands
api.panel.each( function ( thisPanel ) {
thisPanel.expanded.bind( function( isExpanding ) {
if (isExpanding) {
unbindCustomFunctions( currentPanel )
bindCustomFunctions( thisPanel );
currentPanel = thisPanel;
}
});
});
// Listen for section expands
api.section.each( function ( thisSection ) {
thisSection.expanded.bind( function( isExpanding ) {
if (isExpanding) {
unbindCustomFunctions( currentSection )
bindCustomFunctions( thisSection );
currentSection = thisSection;
}
});
});
});
function bindCustomFunctions( sectionOrPanel ) {
// Code
}
function unbindCustomFunctions( sectionOrPanel ) {
// Code
}
} ( wp.customize ) );