Vance Joseph wasn’t coaching on his terms and Denver’s run defense paid a price.

In his first season back in Denver, the Broncos defensive coordinator thought it was best to do things that were similar to what players did under the previous regime. Joseph’s plan, however, backfired. The Broncos gave up the third-most rushing yards in the league (137.1), the most yards per attempt (5.1) and 56 rushes for 10-plus yards, according to Next Gen Stats.

Their performance against the Dolphins — 726 total yards allowed, including 350 on the ground — left a stain that was hard to wipe away.

In the offseason, Joseph knew a philosophical change was needed. He wanted to steer away from shell coverages and instead encouraged his defensive linemen to play with more aggression. Through eight weeks, that shift has paid off.

Denver has been one of the best run defenses in the NFL, making Sunday’s matchup against the Ravens rushing attack spearheaded by quarterback Lamar Jackson and running back Derrick Henry highly anticipated.

“I truly think, in this day and age in the NFL, if you’re not playing on your terms, you’re losing,” Joseph told The Denver Post. “Last year, we (weren’t) doing that and it didn’t help our team win.”

The Bronco’s success has been more than just a change in mindset. They added reinforcements in the trenches to fit their new approach. They traded for former Jets defensive lineman John Franklin-Myers during the draft and signed run-stopper Malcolm Roach to a two-year deal. Meanwhile, outside linebacker Nik Bonitto spent the offseason improving as a run defender so he could be more than a pass-rush specialist.Denver tailored the defense to fit the vision of its leader, and the results have been impressive. Through eight games, the Broncos have given up 106.4 rushing yards per game — seventh-best in the NFL — and four yards per carry.

The Broncos have held opponents under 100 rushing yards four times, with each of those efforts resulting in a victory. They had six games with fewer than 100 rushing yards allowed the entire 2023 season.

“We brought in some guys who play an attacking style, which I think, personally, a lot of top defenses play that way,” Allen told The Post. “It’s been a lot of fun. And when you stop the run, go get opportunities to rush the passer.”

Allen has been one of the league leaders in QB pressures (fifth with 38), but he has played the run well, too. He has 17 run stops, according to Pro Football Focus. Edge rusher Jonathon Cooper and inside linebacker Justin Strnad, who replaced Alex Singleton after his season-ending injury, have also played integral roles with 10 run stops apiece.

Now comes the real test for all of that progress: The Baltimore Ravens.

Over the years, Baltimore has had one of the best rushing attacks. Since 2018, the boys in black and purple finished first in rushing yards three times, and they are on track to do the same this year. Jackson has had a major hand in that, collecting 5,579 rushing yards in seven seasons.

“I don’t think anyone runs the ball as good as those guys because of Lamar,” Joseph said. “It’s like (former Falcons quarterback) Michael Vick back in the day…(those) offenses were always top five in rushing because he added 60 yards.”

Jackson has missed the last two days of practice due to a back/knee injury, but Ravens coach John Harbaugh told reporters in Baltimore that the 2-time MVP was resting on Wednesday. Joseph is planning on Jackson being available. “I think Lamar’s going to play. It’s midseason. Maybe he’s a little beat up. But he’s always answered the bell,” he said.

In the offseason, the Ravens basically added a jetpack to a rocket with the signing of Henry — a four-time Pro Bowler — to a one-year deal. In his ninth season in the NFL, Henry hasn’t lost a step. He has played on an MVP level, rushing for 946 yards and nine scores on 145 carries.

The former Titan has had four games of at least 100 yards rushing. The Broncos, however, have allowed a player to top 100 rushing yards in a game just once: Seahawks running back Kenneth Walker (103 yards) in the season-opener.

“It’s a testament to him,” Roach said of Henry’s longevity. “I’ve seen him train before in Dallas and it was a sight to see. There’s no surprise why he has so much success.”

Joseph said the Ravens have done a solid job executing “The Henry offense,” which is a steady diet of power runs, outside zone and toss plays. The numbers don’t lie: Henry has 77 carries for 632 yards and five touchdowns on outside zone runs, according to Next Gen Stats.

Stopping Henry or Jackson has been problematic over the years. It’s even trickier now that they share the same backfield. Jackson and Henry have a special ability to break loose for explosive runs.

Jackson is first in the league with 20 rushing attempts for 10-plus yards. Henry is right behind him with 19.

The Ravens are an even greater challenge whenever they use read-option plays that make both Jackson and Henry a threat to run. The Broncos could assign a “spy” to cover Jackson specifically on each snap. Such a player would have to be able to put pressure on Jackson and not let him get settled in the pocket.

“The key part is having enough scheme to cover that extra gap because of (Jackson),” Joseph said. “So if you don’t have something to take away that extra gap, that’s the problem.”

Against Baltimore’s offense, it might take more than just stacking the box with eight-plus defenders. Numbers have shown that the Ravens have been effective in running against stacked boxes this season. On 79 run plays against stacked boxes, they have totaled 63.4 yards per game, according to Next Gen Stats.

Henry has 377 rushing yards and eight touchdowns in those situations.

And if the Broncos put more defenders at the line of scrimmage, they could be vulnerable to giving up explosive plays in the passing game.

Jackson is fifth in yards (2,099), second in touchdowns (17) and first in passer rating (115.4). Jackson has done a solid job at spreading the ball around. The Ravens have had nine different players have caught a touchdown pass.

“Some (teams) fill the box, but that sets up a lot of opportunities with the passing game when you’re committed to stopping the run,” Broncos cornerback Pat Surtain II said. “It allows the play (action) pass, (bootlegs), RPOs (and) all those things that feed off the run to have success in the passing game.”

On Sunday, an unstoppable force meets an immovable object.

The Broncos defense has transformed into one of the best in the league, and they look forward to keeping that status against the Ravens.

“They’re the No. 1 ranked offense in the NFL, so it’ll definitely be a great challenge for us to see where (how) we match up against them,” outside linebacker Baron Browning said. “I think we’re all up for the challenge.”