He was a good ruler, not a good monarch. After the deaths of his sons while infants, babies actually, with only surviving daughters, he basically lost faith in the monarchy as institution. He didn't cared about the institution after his lifetime.
>Pedro II is memed to be one of the greatest monarchs in history, and let's admit it, mostly due to his portrayal in the Civ game series
No, he enjoyed a good reputation long, long before any videogame was created. His fame of a wise and just ruler was true to the facts. The country did developed during his rule.