$$ X = \begin{cases} 1, & \text{if $x \in [0,1]$} \\ 0, & \text{if $x \notin [0,1]$} \end{cases} \\[3ex] y = g(x) = \frac{X}{2} $$
Could you please explain why $p_y(y)=p_x(2y) \neq 0, \,on\, [0, \frac{1}{2}]$ instead of [0, 1]?
From MIT press book "Ian Goodfellow and Yoshua Bengio and Aaron Courville", chapter 3 "probability and information theory", page 72:

If one goes by the definition of the cumulative distribution function then the one writes:
$$F_y(\chi)=P(y<\chi)=P\left(\frac x2<\chi\right)=P(x<2\chi)=F_x(2\chi).$$
Hence, the corresponding probability density function is
$$f_y(\chi)=\frac{dF_y}{d\chi}=\frac{dF_x(2\chi)}{d\chi}=2f_x(2\chi).$$
There is the missing factor. It comes up when differentiating the cumulative density function.
(Note: In this form, this calculation is valid only in the case given by the OP.)