BOSTON — Joe Girardi took over as the New York Yankees’ manager in 2008, the final season of pitcher Mike Mussina.

Girardi later witnessed the retirements of Jorge Posada (2011), Mariano Rivera (2013) and Derek Jeter (2014).

This week Girardi is handling the clumsy retirement of Alex Rodriguez. Then, presumably on Oct. 2, he will pencil in Mark Teixeira’s name on the lineup card for the last time.

“I can’t tell you that I anticipated doing this with four or five guys,” Girardi said of the retirement parade.

It’s actually six guys. Maybe he’s not counting A-Rod, who is basically being released after Friday’s game at Yankee Stadium.

The point is the Yankees are finally dealing with their aging problem. We’ve been writing for years about their bloated contracts. For a while those high-priced players kept the Yankees competitive, but the team has been slipping in recent years.

It took a while for the Yankees to face reality. As recently as 2013 – when the Red Sox celebrated a World Series title – New York dipped heavily into free agency, including a seven-year, $153 million contract for Jacoby Ellsbury that fall.

(It’s’s always tempting to throw money at a free agent. Just ask Boston owner John Henry, who signed Pablo Sandoval for $95 million.)

New York went big with free agents before the 2009 season (including Teixeira) and won a World Series. That was the Yankees’ last championship. In the next three years they reached the ALCS twice.

But in the past three seasons, New York finished out of the playoffs twice (2013 and 2014) and lost in the wild-card game last year.

This season the Yankees have hovered around .500. New York prides itself on always being a contender, but the franchise’s decline was unmistakable and something had to be done. The Yankees traded from their strength – the bullpen – by dealing Aroldis Chapman and Andrew Miller. They also traded 39-year-old All-Star outfielder Carlos Beltran.

In return they got 11 players, including some of the top prospects from the Cubs, Indians and Rangers.

Before the season, milb.com (mlb.com’s minor-league counterpart) ranked the Yankees as the 17th-best minor league system in baseball. After the trade deadline, the Yankees soared to No. 2 (the Red Sox dropped from sixth to seventh, likely because of the trade of pitcher Anderson Espinoza).

Among New York’s haul from the trades:

n Shortstop Gleyber Torres, 19, the Cubs’ top prospect, who had a .791 OPS in high Class A.

n Outfielder Clint Frazier, 21, Cleveland’s No. 2 prospect who was recently promoted to Triple-A.

n Left-handed pitcher Justus Sheffield, 20, the Indians’ first-round pick in 2014 with 104 strikeouts in high Class A.

n Outfielder Billy McKinney, 22, the Cubs’ first-round pick in 2013 tore up Class A last year but is .251/.677 in Double-A this year.

n Pitcher Dillon Tate, 22, the Rangers’ first-round pick in 2015 who has struggled in low Class A (4.90).

Add that group to some of the Yankees’ highly regarded young players – first baseman Greg Bird (out with a torn labrum), catcher Gary Sanchez (promoted to New York), outfielder Aaron Judge (expected to be promoted soon), second baseman Rob Refsnyder (with New York) and pitcher Luis Severino (in New York).

The Yankees are rebuilding. That sounds strange to say. Some of these young players will give New York a boost, others might be included in a deal. The Yankees, 10th in the league in starting pitching (4.75 ERA), could use more arms.

The Yanks may be on the fringe of contending in 2017. The Red Sox, last-place finishers the past two seasons, now contend with young talent.

There will be first-place battles between New York and Boston in the future – just with different stars than in the past.

“It will certainly feel different,” Red Sox Manager John Farrell said. “I can’t say it will be less important or less of a focal point. That will always remain, given the cities and the history of both organizations.

“The game moves on. The names are going to change. … This is just the game turning to the next generation.”