RELU is not sophisticated enough here - it is difficult to find good thresholds from univariate input, so optimization rather finds inferior local minimum using linear region of RELU activations.
Also note that adding x^2 to network inputs explicitly considerably simplifies the task.