SAN FRANCISCO — Just two years ago, the scenario would have been unimaginable, the Dodgers down by the four runs in the ninth inning and Dave Roberts calling on Cody Bellinger to be replaced by a pinch-hitter.

Bellinger’s replacement wasn’t Mookie Betts or Corey Seager or even a 41-year-old version of Albert Pujols.

Batting instead of Bellinger was Austin Barnes, the team’s light-hitting backup catcher.

The Dodgers lost a game they should have won, the most talented team in baseball dropping its series finale to a San Francisco Giants team that plays the best baseball. The defending World Series champions departed to St. Louis on Sunday trailing the Giants in the National League West.

With games remaining and the Dodgers only one game behind the Giants, however, the problem wasn’t nearly as alarming as the one they have in Bellinger.

The 26-year-old former NL most valuable player’s extended slump could compromise their chances of overtaking the Giants and threaten to transform their October dreams into a nightmare. The problem became more pronounced before the 6-4 defeat to the Giants at Oracle Park on Sunday when the Dodgers placed AJ Pollock on the injured list with a strained right hamstring.

Pollock’s absence eliminated the luxury the Dodgers had of reducing Bellinger to a platoon role. Bellinger now will play every day.

Dave Roberts will be forced to draw up lineup cards listing players in the eighth and ninth spots that have the offensive capabilities of pitchers — Bellinger and the actual pitcher.

“As of now, with our roster, this is what we have,” Roberts said.

Bellinger is batting .167, the second-lowest average of any player in the majors with 200 or more plate appearances. The only player with a worse average is Jarred Kelenic, a rookie with the Seattle Mariners.

The decline in performance can be explained by injuries. Bellinger’s shoulder was dislocated in the playoffs last year by an idiotic celebratory forearm bash with former teammate Kiké Hernandez.

The shoulder was surgically repaired in the offseason.

Returning from that alone was a challenge. Matt Kemp’s career trajectory was completely changed by a shoulder operation. Adrian Gonzalez said his power was diminished for the next couple of seasons after his procedure.

Bellinger was spiked at first base in April, resulting in him missing nearly two months with a hairline leg fracture. He returned only to experience a series of hamstring problems.

“He’ll be all right,” Betts said. “It is what it is. He went through an injury that takes time to heal and then he got hurt again with his foot.”

Betts could be right: Bellinger could be all right at some point.

But the Dodgers don’t have time.

They are built to win now, the urgency to do so again this season magnified by a possible labor stoppage next year, as well as the impending free agency of several key players, including Corey Seager, Clayton Kershaw, Max Scherzer and Kenley Jansen.

Bellinger just looks lost.

He has only nine home runs in 78 games. He homered 47 times in his MVP season.

Before Barnes batted in his place, Bellinger was hitless in three at-bats Sunday in a bullpen game for the Giants. He struck out on a 95-mph fastball by right-hander Zack Littell. He grounded out to third base softly on a curveball by veteran left-hander Jose Quintana. He grounded out to second base on a 99-mph heater by Camilo Doval.

Bellinger’s troubles handling high velocity have been a consistent problem. He’s batting just .093 against pitches 94 mph or faster, according to Baseball Savant. He hit .276 against such pitches in 2019.

With Pollock down, the Dodgers don’t have any alternatives.

On days the Dodgers faced left-handed pitchers, Roberts started Pollock in left field and Chris Taylor in center. Pollock’s injury locks Taylor in at left field regardless of who is pitching for the other team.

The only other choices on the roster have offensive profiles similar to Bellinger’s, as Zach McKinstry and Billy McKinney are also left-handed hitters who aren’t hitting.

Bellinger at least remains at elite defender at a premium position.

Come October, the Dodgers figure to encounter better pitching, which could produce some low-scoring environments.

In that case, the ability of Bellinger to prevent runs with his glove will have more value, and, who knows, maybe he can save their season the way he did last year when he robbed Fernando Tatis Jr. of a home run in Game 2 of their National League Division Series against the San Diego Padres. At this point, that feels much more likely than him doing anything heroic with a bat in his hands.