So lets as assume Riker accepts one of the commnds offered to him during TNG and leaves the Enterprise, who does Picard choose as his new Executive Officer?
Data is the Second Officer, but there were other officers at both Commander and Lieutenant Commander ranks.
Either Data or an officer from outside the Enterprise.
This. Data's next in line of those aboard ship - Crusher, Troi, etc aren't in the line of command. He wouldn't be guaranteed the post - hell, if it worked that way, Riker could only get either the Enterprise or a ship with no assigned crew! - but if not him, it'd be either the XO of a smaller ship or 2nd-O of a larger ship.