The instance of SQL Server 2012 Express is somehow corrupted.
I suspect this is somehow related to my use of the Entity Framework, but I have no evidence so far.
When trying to restore an instance, the recovery process stuck in step SqlEngineConfigAction_repair_validation_Cpu64.
It was at this stage for a long time without noticeable processor use, so I finally canceled the recovery process.
When you try to delete an instance, the uninstallation process freezes in step SqlEngineConfigAction_remove_validation_Cpu64.
When you try to install the second instance, the installation process freezes at step SqlEngineDBStartConfigAction_install_configrc_Cpu64.
For some attempts, SQL Server services were not previously manually stopped. For other attempts, the services were manually stopped and changed from "Automatic" to "Manual".
Symptoms of database corruption if this helps:
The SQL Server (SQLEXPRESS) service has a status of Running when the system restarts, but gets stuck in the Start state when the service is manually restarted using the Restart option.
When the service stops and starts manually, it displays this error:
Windows could not start the SQL Server service (SQLEXPRESS) on the local computer. Error 1053: The service did not respond to a start or control request in a timely manner.
SSMS (SQL Server Management Studio) cannot connect to the instance. It either tries forever without a timeout or error, or displays this error:
The connection to the server was successfully established, but an error occurred while shaking hands before logging in. (provider: SSL provider, error: 0 - operation timed out.) (Microsoft SQL Server, error: 258)
EDIT: I assume there was a vote against because it was not indicated on the question form. Thus, to clarify, the question is how to solve the problem of the freezing of the recovery, uninstall or installation process?
EDIT 2: As a result, it turns out that the main cause of the damage was shutting down the Windows 7 computer without first shutting down SQL Server services, even though SQL Server Express was not actively used at that time.
EDIT3: The problem seems to have been resolved in SQL Server 2014 Express.