Microcontroller Core Frequency vs Crystal Frequency
Almost any modern microcontroller has an oscillator control block, which typically comprises one or more internal oscillators, pins for external (crystal or other), oscillators, phased locked loops (to multiply the basic osciallator frequency), dividers, and lots of logic to control all this stuff. The end result is that you can generally configure not only the core frequency, but the frequencies used by subsystems such as IO, and memory.
To see the specific features available, you need to study the datasheet. There are also often software configuration tools available (like STM CubeMX).
And no, you don't have to mess with the crystal caps depending on config - the crystal will be internally buffered. Just use the suggested values in the datasheet.