views restored from backup in a different server referring to linked servers
Synonyms will not be useful for your need since that will require changing the view definition to specify 2-part names. 


  I also thought about defining a linked server named Y in Z, but
  pointing to itself. Here I was only able to make a linked server named
  localhost pointing to itself, and this does not help solve my problem.


It is possible to create a loopback linked server with the name Y using SSMS by selecting "Other data source" (instead of SQL Server) and then specifying a SQL Server provider. This can also be done via T-SQL:

EXEC master.dbo.sp_addlinkedserver 
      @server = N'Y'
    , @srvproduct=N''
    , @provider=N'SQLNCLI11'
    , @datasrc=N'.'
    , @catalog=N'YourDatabase';


You'll need to also configure the linked server security context according to your requirements.