If you want to make sure that all days are the same, just compare the min and max. If they are the same, then all values are the same as well.
with dif_zero as (
date_part('day', p.docdate)::int pday
from sh_billing.dogovor d
join sh_billing.pays p on p.dogovor_id = d.id and p.is_actual
group by id
You could create your own aggregate to append arrays:
CREATE AGGREGATE array_append_agg(anyarray) (
SFUNC = pg_catalog.array_cat,
STYPE = pg_catalog.anyarray
Then use that aggregate function in your outer query.