I don't see this as very likely, even if Ferdinand were to predecease his brother without any surviving children.
IIRC, the electors and the rest of the German princes made it clear rather early on that they did not want Philip II as their emperor. He was a foreigner in their eyes, born and raised in Spain, who didn't understand their laws or customs. Honestly, I can't see any way around this, since at this point, Castile is the centre of Charles' domains in terms of importance and to have Philip brought up in the Netherlands would alienate the Castilians, who weren't about to accept another foreigner either (recall: the reasons behind the Communeros).
Also, why would Ferdinand accept Charles' proposal after his death? In OTL he was pretty opposed to it and even if he somehow changed his mind, the electors are on his side and would prefer Maximilian in any case. Even if Ferdinand I were to predecease Charles V, they would likely refuse Philip II and choose someone else--either a compromise candidate or the highest bidder.
If Maximilian becomes a Lutheran, they either choose another of Ferdinand's sons or elect Maximilian anyway. As Constantine said, there was no convention or law that said that the emperor was required to be a Catholic. In fact, given the religiously charged climate of the Reformation, it might make Maximilian II a more attractive candidate, depending on the makeup of the electors at the timing of his election:
Hermann von Wied, the Archbishop of Cologne, was sympathetic to the Reformation for political reasons from 1536 and even broke with Rome for a time until his eventual deposition.
Joachim II of Brandenburg was a Protestant sympathiser (if not a crypto-Lutheran himself) by 1539, although he waited until 1555 to openly embrace Lutheranism)
The Electors Palatine attempted to introduce the Lutheran Reformation in 1544 before backing down a few years later, then successfully did so in 1556, before becoming staunchly Calvinist a few years later.
The Electors of Saxony were firmly Lutheran after 1527.
So, even if Maximilian II adopts the Lutheran faith, depending on the year, if Charles V tries to force Philip II on the electors, there may very well be three or four of them who find that Maximilian has been rendered an even more preferable candidate by his conversion (and don't forget, he may hold a vote of his own as King of Bohemia).