Named Pipes Clarifications
It's because, 

When a client tries to make a connection, it uses the protocols order by priority defined by SQL Server configuration manager. A low value means a high priority. If you configured TCP/IP as first priority and SQL Server is not able to resolve Name to IP it raise the error you posted. But when you disable TCP/IP, then because TCP/IP with first priority is disabled client uses Named Pipe (with second priority) to connect to SQL Server. And get a successful connection. 

Here, you can set the priority of protocols by moving it UP or DOWN.



Thanks