Coach Kyle Shanahan wanted a known commodity for the 49ers’ most-important position.

He wanted Kirk Cousins, and he was willing to wait a year in order to get him.

Then, Jimmy Garoppolo happened.

The 49ers on Saturday will play the Minnesota Vikings in the first NFL playoff game in the six-season history of Levi’s Stadium. Coincidentally, Cousins will be a starting quarterback on the field for the NFC Divisional-Round Game.

Cousins, coming off a regular season in which he threw 26 touchdown passes and just six interceptions, led the Vikings to a 26-20 upset over the New Orleans Saints in overtime in the NFC wild-card round on Sunday.

When Shanahan and general manager John Lynch were hired to rebuild and rebrand the 49ers in 2017, the top priority for the team’s dilapidated roster was to figure out a plan at quarterback.

The 49ers entered free agency without any quarterbacks on their roster and no desire to bring back Colin Kaepernick or Blaine Gabbert from Chip Kelly’s 2016 team.

Washington placed the franchise tag on Cousins for the 2016 and ’17 seasons at salaries of $19.95 million and $23.9 million. If the 49ers could just wait a full season, they would likely get their shot to spend a huge chunk of money on Cousins to be their quarterback in 2018.

“We always knew that was a strong possibility because I didn’t think they were going to franchise him three years in a row, and I thought we’d have a very good chance,” Shanahan said before the 49ers opened the ’18 season against Cousins and the Vikings.

“So I think that’s what we knew was a very strong possibility of happening, and I think we fell into another alternative option that was pretty darn good.”

Lynch had inquired during the 2017 offseason about acquiring Garoppolo -- or, even, Tom Brady -- in a conversation with Bill Belichick. But the Patriots were not interested in making a deal at the time.

Lynch took several pre-draft scouting trips to visit with quarterback prospects Deshaun Watson, Patrick Mahomes, Mitchell Trubisky and DeShone Kizer. Those high-profile trips appeared to be smokescreens, as the 49ers were not interested in any of those players -- certainly not with their top draft pick.

Instead, the 49ers wanted to build the defensive side of the ball, be patient and sign Cousins at the start of free agency the following year. That plan was not well-executed, as the 49ers selected defensive lineman Solomon Thomas at No. 2 overall, then traded up to select linebacker Reuben Foster at No. 31.

Thomas is a rotational player, and the 49ers released Foster in the middle of his second season following multiple arrests.

The 49ers’ offseason activity at quarterback consisted of signing veterans Brian Hoyer and Matt Barkley, drafting C.J. Beathard at the end of the third round and signing undrafted rookie Nick Mullens.

The big splash would be coming at a later date.

Shanahan was offensive coordinator in Washington under his father, Mike, when the team chose Cousins in the fourth round of the 2012 draft. Shanahan much-preferred Cousins' ability to run his offense over Robert Griffin, whom Washington traded three first-round picks and a second-rounder to the Rams in order to move up to select at No. 2 overall.

But five months before the 49ers thought their plan would go into effect at the start of the free-agent signing period, the phone rang. Belichick, shockingly, was ready to send Garoppolo to the 49ers for just a second-round draft pick.

Shanahan and Lynch did not take long to consider their decision. The 49ers had to make the deal. But it also meant Shanahan would have to make a deviation from his original script.

In an ESPN radio several months later, Lynch said Shanahan was "in mourning" for a while because “his master plan was to have Kirk Cousins come in eventually.” A week later, Lynch said he was mostly being facetious and described the feeling within the organization in different terms.

“That day was really like Christmas to us,” Lynch said in March 2018. “Jimmy was a guy that we had coveted. We did a lot of work on him in the offseason. We’d attempted to make a deal. It was rebuffed on a couple of occasions. Shoot, when that opportunity fell into our lap, it was like Christmas.”

When the black Escalade pulled up to Levi’s Stadium with Garoppolo inside on Oct. 31, 2017, the 49ers were 0-8. After spending early mornings and late nights studying the offense, Garoppolo was ready to play after watching for three games.

He stepped onto the field, and the 49ers reeled off five consecutive victories to close out the season. The 49ers saw enough to sign him to a five-year, $137.5 million contract. A month later, the Vikings added Cousins with a three-year, fully guaranteed $84 million deal.

The 49ers and Vikings got their quarterbacks and their catch-phrases -- Garoppolo’s “Feels great, baby” and Cousins with his “You like that!”

Both sides are grateful for how it all turned out.

[RELATED: Why 49ers facing Vikes in playoffs brings back bad memories]

“I have a lot of respect for Kirk and I think he’s in a very good situation and went to a very good place, and I’m very happy for him for that with what he’s been through,” Shanahan said before the ’18 opener. “I’m extremely happy with who we have here and where we’re at and the decision that we made on who to go with before that.”