Let's Encrypt should be fine. The fact that Moodle and Nextcloud are on the same server should not be an issue either. Unless, maybe, this results in different hostnames (for example, maybe the public hostname of your server cannot be resolved locally - that would be an issue, because after authorisation Moodle talks to Nextcloud directly using that hostname).
in my experience, the issues with misconfigured WebDAV + headers are hard to notice, i.e. everything appears totally fine except for a few very special requests that fail without a helpful error message. For example, I have no idea whether the rather special combination of Nextcloud's OAuth + WebDAV + nginx works, and whether those behind that documentation have even tried it. (For example, on misconfigured Apaches, the OAuth authentication header is just dropped without notice - but everything else is fine.)
If you double-checked the configuration and it doesn't work yet, you could try two things. You could ask the Nextcloud community for help on their forums. Maybe they have experience with nginx + OAuth that they are willing to share. Alternatively, try setting up your Nextcloud on an Apache following the official documentation; then try connecting to that.
Good luck, hope this helps!
I've double-checked the nginx configuration, did some minor tweaks, but it still does not work.
I'll try to reach the nextcloud forum, then.