The CDC did what it thought was pragmatically the best thing to do considering the political reality at the time.
> There are worse things than getting sick.
Disease control codes are as old as law. We live in a society, and part of keeping society running is keeping it healthy.
the eviction moratorium was implemented because the alternative was a good fraction of the population getting evicted on a very short timescale. the legal and police infrastructure to carry it out simply did not exist, and any attempt would have been overwhelmed with refusal and defensive organizing.
any solution would have been problematic and disruptive to property rights. the CDC exceeding their authority just provided some realpolitik deniability for elected officials, and prevented open revolt.