Short answer: If you read the script, it's not that hard to piece together. He never was anti republic, he just thought the republic would fall in line under the chancellor. He was anti Jedi, but looking at the script, I don't see him being anti republic or democracy per-say, at least, not in his mind. Others would see him that way, be he didn't see himself that way.
After the battle where Anakin helps Palpatine kill Mace Windu, Palpatine convinces Anakin that the Jedi want to take over the senate. He tells him to kill all the Jedi in the temple, mostly trainees and younglings I think. (his words are Kill all the Jedi), but what's discussed after the fact is killing younglings.
The lines spoken, in real "Movie" time chronology not movie watching chronology
Palpatines words to Anakin are:
Once more the Sith will rule the galaxy! And... we shall have...
and after Anakin kills the younglings, Palpatine to Anakin:
You have done well, my new apprentice. Now, Lord Vader... go and bring
peace to the Empire.
Where he's basically telling Anakin to kill the trade federation leaders and "stop the war".
Then Anakin has his talk with Padme before leaving where he says:
I will not betray the Republic. My loyalties lie with the
chancellor... and with the senate and with you.
Padme: What about Obi-Wan?
I don't know. Many Jedi have been killed. We can only hope that he's
remained loyal to the chancellor.
and on the planet where Padme sees and talks to him, he says
We don't have to run away any more. I have brought peace to the
Republic. I am more powerful than the chancellor. I can overthrow him.
And together, you and I can rule the galaxy... make things the way we
want them to be.
and a few moments later, to Obi-Wan
Don't lecture me, Obi-Wan. I see through the lies of the Jedi. I do
not fear the dark side as you do. I have brought peace... freedom,
justice and security to my new empire.
and shortly before Anakin loses the fight
I should have known the Jedi were plotting to take over.
From my point of view, the Jedi are evil.
So, to Anakin's mind, the Jedi are power hungry, evil and want to take over. To him, the "republic" will fall in line under Palpatine, with him, Palpatine's right hand man. He uses the word republic and empire almost interchangeably, just a few moments apart. Now, it's an important moment, he still calls it a republic when he talks to Padme about ruling it, but after he thinks Padme betrayed him, he calls it his empire, but it's a rather thin line between "his republic" and "his empire".
So, to his thinking, he is loyal to the republic, under his and Palpatine's rule. So, I don't see the conflict you're asking about. he's convinced the Jedi are evil, and he's sufficiently brainwashed and power hungry to overlook Palpatine's schemes.
. . .
Now, much can be said about George Lucas' much maligned prequilogy. I personally find it unbelievable that Anakin went from conflicted and willing to arrest and put on trial Palpatine, then one conversation later he's convinced the Jedi are evil and he's killing children upon request. I don't buy that, and that's a pretty big reach that Lucas expects us to buy.
But there are aspects of the story that are quite good. Anakin's desire, practically a lust for power after he feels the Jedi held him back. His sense of self importance, so when Palpatine tells him "I have a very important job for you" - that very much appeals to him after he felt underutilized by the Jedi. Even his conversations with Padme, while some people found their lovey-dovey talk unbearable, I felt it accurately portrayed how tortured he felt being away from her and all he had to offer her was his love, he had no charm or conversation or pretty words to offer, but he did love her and that was enough for her. She was, afterall, a warrior too. I also found his uncontrollable anger and strangling Padme after he thinks she turned against him - all believable . . . but to me, "I have a job for you, go kill all the jedi-children" - That I didn't buy.
Hope I haven't strayed too off-topic.