The classical double copy in maximally symmetric spacetimes