The cost of some countries opting out would need to be factored into the decision to go ahead, but since the EU already doesn't prevent member states from entering bilateral or multilateral arrangements, all I'm saying is that those should be made part of the EU structure.
Also, new applicants for membership don't get to opt out of anything. "It's the statue, man, The Statue."