Hmmm... like perhaps setting up a separate section, or even small book, full of 'sideplots' suited for specific level ranges but with the NPCs and such unnamed so that if the party does get sidetracked by a specific NPC or Situation, you can snag a sideplot in the right level range with a few pre-generated encounters and the bare bones of some NPC interactions and then apply the names of NPCs in and around the current area to those encounters and sideplots that allows them to be wrapped up, nicely?
That way the distraction gets to be explored to a conclusion resolved with social, exploration, or combat mechanics, and the players can then return to the main plot?