In recent versions of the IDE (anything that supports board manager), modifying the builtin cores is awkward and fiddly - the IDE is not meant to support that. The IDE only supports (as in, makes easy to do and doesn't fight you) modifying cores installed by putting the core files into (sketchbook)/hardware.
Guides that describe modifying pins_arduino.h (or other files in the default core) should be considered obsolete - modifying files in the default core is not something you should be doing anymore - if you need to do that, you make your own hardware package. But as noted above, it's silly to do that for this purpose as there's already a core that does all that for you (in addition to having a bunch of other improvements - I use MiniCore instead of the official cores for everything relating to 28/32 pin ATmega parts instead of the official AVR board packages), and can be installed either manually or via board manager
I agree with DrAzzy: "in general, you don't want to do that."
However, it can be useful to LOOK at the pins_arduino.h and other "variant" files, even if you don't intend to use them. If you turn on "verbose" logging for compilation, pretty much every line will include an option that includes the subdirectory "variants" like: