I think it’s really important to remember that with Sirius, it’s not really about Voldemort and never was. It was always about his friends.
I see Sirius as a born contrarian who pushed boundaries pretty much from the time he could talk, mostly to see if he could. By the time he gets on the Hogwarts Express, Sirius is at least vaguely conscious of the fact that his parents’ love is contingent on him being the Black heir he’s supposed to be. So like the irreverent contrarian he is, he zigs when he’s under immense pressure to zag.
But being sorted into Gryffindor puts him in unfamiliar territory. His fellow Gryffindors are suspicious of him, his parents are livid (far more than he expected), his (pureblood) friends from his pre-Hogwarts days are freezing him out, and he probably thinks muggleborns have horns or some shit.
But lucky for him, he falls in with his new dormitory mates. They offer attention and sympathy when others in his life are freezing him out, and Sirius latches onto them. Hard. James isn’t just his best friend, he’s as good as his brother. Better than, even, since Sirius’s actual brother is barely speaking to him.
He also feels intensely loyal to his friends for the role they played in deprogramming him.
Sirius’s upbringing has given him a warped view of the world and left him rather bereft for what we might call moral boundaries. From his first day at Hogwarts, he’s reliant on his more enlightened friends to inform him that no, muggleborns don’t have horns. And whether he realizes it or not, he continues to rely on his friends to tell him that no, mothers aren’t supposed to say things like that to their kids. He also relies on his friends to let him know when he himself crosses a line, because god knows his parents never modeled well-adjusted moral behavior.
So he takes his cues from his friends, matches their morality (particularly James), and basically builds his entire worldview around the idea that these three people are the center of the universe.
The war only intensifies this bond. We see Sirius’s intense loyalty to James manifest in a number of ways, but one of the most memorable occasions is in PA:
THEN YOU SHOULD HAVE DIED!“ roared Black. “DIED RATHER THAN BETRAY YOUR FRIENDS, AS WE WOULD HAVE DONE FOR YOU!”
To Sirius, the actual ethos of the anti-Voldemort movement is secondary to the simple fact that these people are his friends. They have loved him unconditionally and stood by him when others have not, and he’ll do anything to protect them. The sense of moral righteousness he gets to feel when cursing Bellatrix is merely a bonus.
And in Sirius’s world, disloyalty to a friend is the absolute worst possible offense one could commit. He’ll stand by his friends come hell or high water, whether that means surviving off rats, breaking out of prison, getting himself thrown back in prison, or going up against a mass murderer.