I don't think Ulfric knows he is helping the Thalmor. He probably really thinks what he is doing is the very best for Skyrim. But the Thalmor dossier proves different. Here, you might want to take a look at this:
Status: Asset (uncooperative), Dormant, Emissary Level Approval
Description: Jarl of Windhelm, leader of Stormcloak rebellion, Imperial Legion veteran
Background: Ulfric first came to our attention during the First War Against the Empire, when he was taken as a prisoner of war during the campaign for the White-Gold Tower. Under interrogation, we learned of his potential value (son of the Jarl of Windhelm) and he was assigned as an asset to the interrogator, who is now First Emissary Elenwen. He was made to believe information obtained during his interrogation was crucial in the capture of the Imperial City (the city had in fact fallen before he had broken), and then allowed to escape. After the war, contact was established and he has proven his worth as an asset.The so-called Markarth Incident was particularly valuable from the point of view of our strategic goals in Skyrim, although it resulted in Ulfric becoming generally uncooperative to direct contact.
Operational Notes: Direct contact remains a possibility (under extreme circumstances), but in general the asset should be considered dormant. As long as the civil war proceeds in its current indecisive fashion, we should remain hands-off. The incident at Helgen is an example where an exception had to be made - obviously Ulfric's death would have dramatically increased the chance of an Imperial victory and thus harmed our overall position in Skyrim. (NOTE: The coincidental intervention of the dragon at Helgen is still under scrutiny. The obvious conclusion is that whoever is behind the dragons also has an interest in the continuation of the war, but we should not assume therefore that their goals align with our own.) A Stormcloak victory is also to be avoided, however, so even indirect aid to the Stormcloaks must be carefully managed.
Source:
http://www.uesp.net/wiki/Skyrim:Thalmor_Dossier:_Ulfric_Stormcloak
The Thalmor love the Rebellion. To them, it is a faction that weakens the Empire in its attempt to regain strength. It increases their chance at victory, because now the Empire has to fight the Stormcloaks
and the Aldmeri Dominion. Ulfric probably isn't aware of that, but sadly that is the way it is going. Do you remember the Thalmor agents who were there during the execution? They were trying to save Ulfric. His death would mean the Empire could focus on the Thalmor again, which they didn't want.
You have to understand no one liked the White Gold Concordat. Even the Empire didn't want to ban Talos worship. But they had two choices: either fighting until the last soldier would get crushed, or signing a temporary peace treaty. The Aldmeri Dominion was much stronger than them. They couldn't possibly win, so carrying on meant
death. The Thalmor would win the war and wipe the Empire off of the face of Nirn. The last banner against being completely invaded by the Aldmeri Dominion, would disappear. Because you know what happens when you lose a war? You lose everything. You are completely dependent on the mercy of your enemy because you don't have the strength to go against them anymore.
the Imperial armies were in no shape to continue the war. The entire remaining Imperial force was gathered in Cyrodiil, exhausted and decimated by the Battle of the Red Ring. Not a single legion had more than half its soldiers fit for duty. Two legions had been effectively annihilated, not counting the loss of the Eighth during the retreat from the Imperial City the previous year. Titus II knew that there would be no better time to negotiate peace, and late in 4E 175 the Empire and the Aldmeri Dominion signed the White-Gold Concordat, ending the Great War.
Source:
http://www.imperial-library.info/content/great-war
If you sign a peace treaty, that gives you time to rebuild your forces. You can regain strength and make sure you're ready for the next round. And that is what the Empire is doing, and they are almost ready. At the moment you start the game, the Legion is already at the Aldmeri Dominion's border - ready to continue the fight. And you can choose: are you going to get your independence, weaken the Empire and thus strengthen the Dominion, standing on your own as a province? Is Ulfric's rebellion, which only exists within the Skyrim border, your big weapon against the Elves? If even the Empire had trouble defeating them, then why would Skyrim be able to do it alone?