Feeling frustrated with an underachieving team, boxed in by the labor deal and like he was running out of buttons to push, Theo Epstein nearly pressed the one that would have blown up the 2017 Cubs.

The defending World Series champs came dangerously close to becoming trade-deadline sellers and trying to shop upcoming free agents like All-Star closer Wade Davis and Cy Young Award winner Jake Arrieta.

“If we had fallen eight, nine out, we would have certainly been looking at considering moving some of the players who were rentals,” Epstein revealed Tuesday at Wrigley Field. “But we immediately played great out of the stretch and didn’t have to head down that road, which you honestly never want to go down.”

It’s easy to gloss over now that the Cubs ramped up and welcomed the new additions – lefty reliever Justin Wilson and veteran catcher Alex Avila – into their clubhouse for a six-game homestand against the Arizona Diamondbacks and Washington Nationals.

But there were only so many times the Cubs could demote Kyle Schwarber to the minors, cut ties with Miguel Montero, reshuffle the batting order or send messages through the media before Epstein would have to weigh punting on this season.

Epstein’s front office did its part during the All-Star break, engineering a blockbuster trade with the White Sox for Jose Quintana that was more about solidifying the 2018, 2019 and 2020 rotations than trying to save the 2017 season.

Quintana showed up in the visiting clubhouse at Oriole Park at Camden Yards on July 14 and introduced himself to a 43-45 team that trailed the Milwaukee Brewers by 5.5 games. Imagine the psychological damage if the Cubs had completely wasted the eight-run lead that night in Baltimore before Addison Russell’s game-winning homer in the ninth inning – or if the Brewers had closed the Quintana deal they discussed extensively with the White Sox and stayed hot throughout July.

“With the new CBA the way it is,” Epstein said, referring to the restrictions on spending internationally, luxury-tax implications and a modified qualifying-offer system, “contending teams, when they have an off year, have to take a hard look at selling in a given year, because it’s important to recoup young talent whenever you have an opportunity to do so.

“You never want to be in that situation, but it forces you to be realistic if you are.”

Between the Quintana boost, several key players getting healthy, a chance to recharge and talent rising to its level, the Cubs swept the Orioles and Atlanta Braves on the road and roared out of the All-Star break with a 13-3 surge that left no doubt about what to do before the July 31 trade deadline.

That leaves August for waiver deals and a narrow window to reframe potential postseason rosters. But Epstein didn’t sound all that interested after sending right-hander Justin Grimm and catcher Victor Caratini to Triple-A Iowa as the corresponding moves to the Wilson/Avila trade with the Detroit Tigers, because this is a first-place team in the National League Central again.

“It’s always possible,” Epstein said. “But right now, we have a pretty cramped 25-man roster. We had to option two good players to make room for the acquisitions. Justin Grimm is a major-league reliever – and a good one – and Victor Caratini showed great in his first exposure to the big leagues.

“For the right player, we’ll get creative. But we really like our 25-man roster now.”