The stated requirement is “…to route the traffic dynamically based on the domain the client is trying to access.” Domain name, not port number.
You’re welcome to to second-guess the OP. I’ll be the first to agree that people often ask for Thing A and should in fact be asking for Thing B. Even so, I choose to answer the question given in this instance. Who knows, he may choose your option. I’m not telling you you’re wrong to offer an alternative, but should we not give the OP enough information to choose from the options, one of which is what he said he wanted?
NGINX proxy blah blah blah sounds like a bad kung fu movie. Its knowitallconfigsnobbery plain and simple.
I assure you, there are a lot of real-life nginx ninjas out there, managing what must be millions of instances. This is not esoteric knowledge. You simply don’t know how to do it yet.