The evolutionary status of ultraluminous X-ray sources