Immunity isn't well understood, or at least it wasn't well understood when government guidelines came down.
Also if the government risks hospital overcapacity by not imposing restrictions, and high deaths per capita resulted, then that would look very bad politically.