In University physics, they wrote, " weight of an object is the total gravitational force exerted on it by all other objects in the universe."
I think this definition is wrong, or, at the very least, generalizes the notion of weight as applied to everyday objects in an unhelpful and potentially misleading way.
The thing about weight is that it is a quantity that is context-dependent. It is in general meaningless to talk about “the weight of an object X”. What is meaningful is to talk about “the weight of an object X on the surface of the earth” or “the weight of an object on the surface of Mars” or “the weight of X inside a spaceship accelerating at 2g of acceleration with respect to an inertial reference frame far away from any celestial bodies”. You have to have that contextual information in order for weight to be calculated. With objects of near-human scale, usually we assume that the weight will be measured on the surface of the earth if that context isn’t provided explicitly, since almost all humans and human-related objects are earthbound anyway. However, with planet-sized objects this assumption is less natural - certainly imagining putting the earth on a scale that itself sits on the surface of the earth requires a nontrivial act of mental gymnastics - so in such a situation it is best to specify the context explicitly to avoid confusion and ambiguity.
Now, the university course definition you cited attempts to generalize the “standard” (i.e., with respect to earth’s surface) weight in a way that is universal and doesn’t require specifying a context. I admit that the way it does that is kind of clever. But I don’t think the resulting quantity is one that will end up being very useful or interesting, particularly because there are in fact some good reasons to occasionally talk about how much things weigh in contexts where this definition will give an incorrect answer - on a rocket, a fighter jet, on the ISS, etc. In other situations, like when talking about the weight of the earth, with this definition one gets a number that is well-defined and not in conflict with any other obviously better number (so in some sense this definition may be “correct”), but simply not useful for anything. The mass of the earth in kilograms is a meaningful and quite interesting number; that number multiplied by 9.8 (in SI units), or by the gravitational acceleration of the earth caused by the sun, are both just arbitrary numbers of Newtons that no one cares about.
Finally, another thing to note is that other quantities in physics also depend on contextual information in a similar way to weight. For example, we often talk about “the moment of inertia of a body” but what we really mean is the moment of inertia of the body with respect to a given axis. The velocity of a body is measured with respect to a given inertial frame of reference, etc - so you see it is standard for various physical quantities to depend on context. I don’t think there is any advantage to doing away with the contextual information (other than perhaps to remove the discomfort that someone must have felt about needing to specify this context), so the trick of using the gravitational influence of the rest of the universe as your reference to get a context-free definition is just that, a trick, and nothing more.