But they were able to beat the ottomans for a period then. They'd also possibly be able to expand. As opposed to this war where it just left them penniless and hit their population massively . Getting rid of or hurting the ottomans would be good for them. The Persians kept them busy, so perhaps the two could do some lasting damage together
Well, the 30YW hit them hard but it also left them with an army (and an experience to raise one) and the competent commanders of all levels. People like Montecuccoli don't just grow on the trees to pick up a fully qualified army commander when you need one. And don't forget that besides the Ottomans there were French and the wars of Louis XIV.
On the early stage of the 30YW (prior to the "Wallenstein period") the Austrian Hapsburgs did not show any outstanding ability to raise sizeable armies of their own. Actually, their own army was too small to prevent the Bohemian-Hungarian troops to advance all the way to Vienna. To reverse the tide they needed the troops of the Catholic League and the Spanish troops from the Netherlands. But on the later stages of war they learned how to raise and keep in the field the adequate armies.