Creo que he encontrado el problema. Tenía esto:
after_ssl:
- replace:
filename: "/etc/runit/1.d/letsencrypt"
from: /--keylength/
to: "-d example.com -d www.example.com --keylength"
Cuando debería haber tenido:
after_ssl:
- replace:
filename: "/etc/runit/1.d/letsencrypt"
from: /--keylength/
to: "-d example.com --keylength"
Fíjate en la última línea; tenía example.com y www.example.com.
También cambié return 301 https://$host$request_uri; por return 301 $scheme://$host$request_uri;, hice una reconstrucción y parece que ya funciona.
Ahora solo me preocupa lo que mencionó @Stephen sobre que podría dejar de funcionar si cambia la configuración de Let’s Encrypt.