The guidelines don't say "Use only colors that would provide 3:1 contrast with black words and 4.5:1 contrast with a white background." – that is given in the guidelines as an example that would pass, but is certainly not the only way to pass. The requirement is only for a 3:1 contrast with surrounding text. The 4.5:1 in the example is a bit of a red herring anyway because that is only required to achieve level AA whereas 1.4.1 is a level A success criterion.