Can I use a variable for an object name?

I hope the question is accurate. (And my description).

Consider the following:

// Declare an object of class WiFiClient, which allows to establish a connection to a specific IP and port
// Declare an object of class PubSubClient, which receives as input of the constructor the previously defined WiFiClient.
// The constructor MUST be unique on the network.
WiFiClient myClient;
PubSubClient client(myClient);

Since most of my programs use these classes, it isn't unusual for me to copy a boilerplate or clone a similar program for modification, and accidentally forget to make the constructor unique.

So, is it possible to use a variable or macro or const instead of "myClient". Is there a way to make this dynamic?

No, you can't use a variable as an object name, but you can define a class that includes all your boilerplate stuff AND includes (or inherits even) one or more of these other classes so that all you need to do is create your new object with it's new name instead of copying in all the code.

myCustomClass uniqueName(whateverArg, whateverArg2);

and that class has members of the types you need like a WiFiClient and a PubSubClient and you don't have to worry that they have the same name because they're different instances of the class.