I haven't directly tested this, but FWIW I did notice that you don't need to remove the certificate to get it to renew - it also seems to block so I'm pretty sure you can drop both the deletion and the sleep after renewal from the scheduled script. I did also update
this thread with a solution with an L7 filter and to point back to this thread.
[admin@yourrouter] > /certificate enable-ssl-certificate dns-name=my.example.com
progress: [success] ssl certificate updated
Modified it would look like:
/system script add name=letsencrypt-renew policy=read,write source=":local dnsName \"PUT_YOUR_DNS_NAME_HERE\";\r\n/ip service enable [find name=\"www\"];\r\n/certificate enable-ssl-certificate dns-name=\$dnsName;\r\n/ip service disable [find name=\"www\"];"
/system scheduler add interval=9w name=letsencrypt-scheduled-renew on-event=letsencrypt-renew policy= read,write