Hot gas in evolving galaxy clusters and groups - Implications for the microwave and X-ray backgrounds