Sir Cadogan likely wasn’t fired for Sirius.
Though Professor McGonagall did question him about if he let Sirius in, she only seemed upset with Sir Cadogan when she thought he let Sirius in without the password. After she learned that Sirius did have the passwords, she was instead angry at the student who wrote them down, Neville Longbottom.
“Sir Cadogan, did you just let a man enter Gryffindor Tower?’
‘Certainly, good lady!’ cried Sir Cadogan.
There was a stunned silence, both inside and outside the common room.
‘You – you did?’ said Professor McGonagall. ‘But – but the password!’
‘He had ’em!’ said Sir Cadogan proudly. ‘Had the whole week’s, my lady! Read ’em off a little piece of paper!’
Professor McGonagall pulled herself back through the portrait hole to face the stunned crowd. She was white as chalk.
‘Which person,’ she said, her voice shaking, ‘which abysmally foolish person wrote down this week’s passwords and left them lying around?’
There was utter silence, broken by the smallest of terrified squeaks. Neville Longbottom, trembling from head to fluffy-slippered toes, raised his hand slowly into the air.”
- Harry Potter and the Prisoner of Azkaban, Chapter 13 (Gryffindor versus Ravenclaw)
After that, it’s clear that Neville is the one Professor McGonagall faults for Sirius being able to break in. Neville is punished severely, and isn’t allowed to know the passwords.
“Neville was in total disgrace. Professor McGonagall was so furious with him she had banned him from all future Hogsmeade visits, given him a detention and forbidden anyone to give him the password into the Tower. Poor Neville was forced to wait outside the common room every night for somebody to let him in, while the security trolls leered unpleasantly at him.”
- Harry Potter and the Prisoner of Azkaban, Chapter 14 (Snape’s Grudge)
It doesn’t seem like McGonagall considered Sirius being able to break in Sir Cadogan’s fault - he let Sirius in because he had the passwords. Instead, she placed the blame squarely on Neville for keeping a list of the passwords.
His post was probably always temporary.
Though Professor McGonagall was surprised to learn that Sir Cadogan let Sirius Black into Gryffindor Tower, the reason he was ‘fired’ may simply be because the Fat Lady was finished being restored, and therefore able to take her job back. Sir Cadogan being removed as the guard for Gryffindor Tower coincided with the Fat Lady being fully restored and returning to her job.
“Sir Cadogan had been sacked. His portrait had been taken back to its lonely landing on the seventh floor, and the Fat Lady was back. She had been expertly restored, but was still extremely nervous, and had only agreed to return to her job on condition that she was given extra protection.”
- Harry Potter and the Prisoner of Azkaban, Chapter 14 (Snape’s Grudge)
Sir Cadogan was never the optimal choice for Gryffindor Tower’s guard. When the Fat Lady was attacked, the only reason he got the job to begin with was because he was the only one who was willing to take it.
“The Fat Lady’s ripped canvas had been taken off the wall and replaced with the portrait of Sir Cadogan and his fat grey pony. Nobody was very happy about this. Sir Cadogan spent half his time challenging people to duels, and the rest thinking up ridiculously complicated passwords, which he changed at least twice a day.
‘He’s barking mad,’ said Seamus Finnigan angrily to Percy. ‘Can’t we get anyone else?’
‘None of the other pictures wanted the job,’ said Percy. ‘Frightened of what happened to the Fat Lady. Sir Cadogan was the only one brave enough to volunteer.”
- Harry Potter and the Prisoner of Azkaban, Chapter 9 (Grim Defeat)
Therefore, it seems highly likely that he was always going to be taken off the post once the Fat Lady was able and willing to return to her place guarding Gryffindor Tower.