The fact that erasing iOS removes all unique IDs is completely intentional. Apple have purposefully made it difficult to get a unique ID that persists such events. This is for user privacy.
Apple doesn't care whether your application can track its users or not. Apple cares that it users are happy. And Apple's users expressed desire for more control over privacy settings, what apps can see and track etc. So Apple made all forms of unique ID difficult to obtain and persist for this exact reason.
Apple have provided APIs that can generate UUIDs for advertising/statistics/analytics tracking (described in other answers to this question). Use those IDs, because that is what they are intended for. MAC addresses were never intended to uniquely identify users.
You want to track a user. UDID and MAC addresses track devices, not users. Devices can be sold, gifted, lost or stolen. If you continue to use the same ID then you are not always tracking the same user. What if the user buys a new phone? Wouldn't you want an ID to follow them to the new device? Or is that a case where you don't care that the ID isn't persisted?
Furthermore, some users don't want to be tracked. Is that something you have considered? Are you providing a way for users to opt out? If you start tracking a user, and you use an ID that persists the app reinstall, persists the OS reinstall and there's no way for a user to opt out, how do they get you to stop tracking them?
The bottom line is that you really shouldn't be worrying about trying to get an ID that persists even past an OS reinstall.
To properly track a user you should make them create a user account.