Interesting. IOTL Leopold I had daughters, in fact his eldest daughter was married to the Prince-Elector of Bavaria. To increase the chances of Lorraine, you might need Leopold I only having one surviving son instead, either Joseph or Charles and like OTL have him have only daughters. Otherwise the Bavarian match would still go ahead, since IMHO by that point Leopold I would still think, he has enough time to sire a son.
With either only Leopold or him just having one son, there's no available Austrian Habsburg claimant for the Spanish throne, that does not prevent them from claiming a part of the Spanish inheritance though, the duchy of Milan and the Southern Netherlands would be plausible candidates for this. The duchy of Milan will be contested by the house of Savoy though
If there already is a Wittelsbach Spain, the other powers might prefer another candidate for Austria, this might help the house of Lorraine. Austria will certainly cost the house of Lorraine, the duchies of Lorraine & Bar, or depending on how the Spanish succession was resolved, the duchy of Milan.
Having a pragmatic sanction and marrying his daughter to a preferred heir does not totally exclude each other. More importantly it's the shape the country is in. Sure Bavaria is stronger than Lorraine, but Austria with Bohemia and Hungary is stronger than Bavaria.
Let's say the following happens.
Stage 1, the end of the Spanish Habsburgs:
House of Wittelsbach (Joseph Ferdinand) gains Spain and the colonies.
The duke of Anjou gets the kingdoms of Naples and Sardinia, while the Dauphin gets the duchies of Lorraine & Bar.
The house of Lorraine is compensated with the duchy of Milan.
In recognition of the claim of the house of Savoy, they receive the kingdom of Sicily.
In recognition of the claim of the Austrian Habsburgs, they are left with the Southern Netherlands.
Stage 2, the end of the Austrian Habsburgs:
Lorraine, is preferred by the Great Powers, to inherit Austria, Hungary and Bohemia, but loses the duchy of Milan.
Savoy really wants the duchy of Milan (it helps is the Savoyard forced defeat the Milanese forces of Lorraine) and propose the following trade: Savoy gets the duchy of Milan, but they also exchange* the kingdom of Sicily for the kingdom of Sardinia with the king of Naples (duke of Anjou).
The Southern Netherlands is a bit of a wild card. Either Bavaria gets it as compensation or Austria keeps it, because England and the Dutch Republic do not want France to have it, and Austrian Forces have managed to defeat Bavaria.
(*= this would allow the duke of Savoy to retain a title of king (even though Sicily was seen as a much greater price than Sardinia); while at the same time recognize the fact that Sicily, though valuable, is also distant and vulnerable; finally it recognizes that both Milan and Sicily would be more than Powers greater than Savoy would allow Savoy to have)