A positive answer to this problem is given by the known answers to the following problem posed by de Groot in New Scottish book.

**Problem 393** (de Groot; 28 May, 1958). *Does there exist a (plane) continuum which does not admit any continuous map into itself except trivial ones.*

This problem has been resolved by Cook (and Maćkowiak). The (historical) information on the solutions of de Groot' Problem 393 can be found on pages 308-309 of Mauldin's "The Scottish Book", New Edition of 2015. Mauldin writes that Knaster posed the same problem on the Topological Seminar in Warsaw University on October 22, 1930. So, the question of Dominic van der Zypen is in fact, very old.

It was answered by Cook (and Maćkowiak) who constructed 1-dimensional (planar) continuum $X$ whose any self-map is either the identity or constant.

It is clear that Cook's (or Maćkowiak's) continuum has the two properties required in OP of Dominic van der Zypen.

**Remark.** Topological space $X$ is called *strongly rigid* if each continuous self-map of $X$ is either constant or the identity.
Many examples of (non-metrizable) strongly rigid spaces are constructed in this paper of Kannan and Rajagopalan.