City maintained their perfect start to the season with a fifth straight league win, moving three points clear at the top of the table. However, the defending was far less convincing than the attacking display.
Antoine Semenyo scored twice, while Enzo Fernandez, Rayan Cherki and Erling Haaland were also on target. Sunderland hit back through a hat-trick from Brian Brobbey and pushed City all the way.
"To be honest, I prefer to win 1-0 than 5-3, but I expected a very difficult game," Maresca said.
"I knew how good they are, off the ball very aggressive and on the ball they have different weapons: set-pieces, and Brobbey."
The result extended City's winning run to seven matches in all competitions following their defeat by Arsenal in the Community Shield.
Maresca said the variety of challenges his side had faced during that run had provided valuable lessons.
"The good thing also is that these seven official games we played are all different," he said.
"We experienced different things, the last one with 10 men against Manchester United, today was a complicated one, the Bournemouth one we were losing 1-0, so also a chance to learn."
Brobbey's three goals were his first of the season and made him the first player since 2007 to score a Premier League hat-trick and still finish on the losing side.
Sunderland manager Regis Le Bris was pleased to see the striker find his scoring touch.
"I'm really pleased for him because it's never easy to have a long period without scoring. Now it's done," Le Bris said.
The Sunderland boss also felt his side could have scored even more after repeatedly causing problems for City.
"It's a defeat, but we are proud of the level of the squad," he said. "We created many chances. Probably deserved to score two or three more goals, so it was really tight.
"At that level, against one of the best teams in Europe, a half chance gets punished, and it's probably the lesson of the day."
City will face another major test when they travel to Anfield to play Liverpool on Sunday, October 11.