Distributed Cache Service cannot be started

Today we ran into an interesting problem. The distributed cache service was no longer working. As it was a single server environment, we removed the service instance and reprovisioned it following:

https://technet.microsoft.com/en-us/library/jj219613.aspx

Strangely, it refused to start and went back to the services page. In the end, the following powershell fixed the distributed cache (after we re-added the spserviceinstance)

$instanceName ="SPDistributedCacheService Name=AppFabricCachingService"
$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
$serviceInstance.Unprovision()
$instanceName ="SPDistributedCacheService Name=AppFabricCachingService"
$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
$serviceInstance.Provision()