Viewing the 2020 campaign from this perspective, the Democrats nominating Sanders would be not unlike Republicans nominating Mitt Romney in 2012. The GOP suffered steep losses in 2008, but roared back to reclaim Congress in 2010 based on widespread opposition to Obamacare. Having championed a mandate-based health system as governor of Massachusetts, Romney was effectively neutered on this key issue, dampening partisan enthusiasm for his candidacy. Nominating Sanders would require either a Romney-esque flip on immigration, or dispiriting the Democratic base on the issue that largely defines and fuels their opposition to Trump.
Sanders can try to spin his immigration position as a feature rather than a bug. Republicans tend to win on immigration when the question is whether America should have borders and enforce them. Democrats tend to gain when the issue becomes what to do about those who have already crossed into our country illegally (e.g., family separation, a path to citizenship, etc.)
By rejecting open borders, a Sanders-Trump debate would play out on more Democratic turf. Sanders might also argue that his position is a better fit to attract Obama-Trump voters in the Rust Belt and Midwestern states Hillary Clinton lost.