Your textbook is inaccurate.
First of all, it should be total mass, not total weight.
The following statement is correct: A mole of atoms with an atomic weight of 12 has a total mass of 12 unified atomic mass units.
But you cannot say: A mole of atoms is the number of atoms whose total mass (not weight!) is the atomic weight. (wrong!) although it might look very similar.
The atomic weight is an alternate name for relative atomic mass. It is "The ratio of the average mass of the atom to the unified atomic mass unit." (source) It has no unit.
A mole is a unit of amount. "The mole is the amount of substance of a system which contains as many elementary entities as there are atoms in 0.012 kilogram of carbon-12. When the mole is used, the elementary entities must be specified and may be atoms, molecules, ions, electrons, other particles, or specified groups of such particles." (source)
So your textbook sentence should end: A mole of atoms is the number of atoms whose total mass is 0.012 kg if they were all carbon-12 atoms.
The unified atomic mass unit (see definition of atomic weight) is "one twelfth of the mass of a carbon-12 atom in its ground state" (source).
So, a mole of atoms is the number of atoms whose total mass is the atomic weight (relative atomic mass) multiplied by one twelfth of the mass of an carbon-12 atom.
Or, a mole of atoms is the number of atoms whose total mass is the atomic weight (relative atomic mass) multiplied by the unified atomic mass unit.
I find these statements much harder to understand than the original definition ("a mole is as many elementary entities as there are atoms in 0.012 kilogram of carbon-12").
What might have some application: One mole of atoms with the atomic weight $x$ have a total mass of $x$ amu.