WebP is actually two completely different compression formats developed by different teams at different times for different purposes (VP8 video codec + lossless add-on by Google).
The WebP encoder just has a switch when quality=100, then use the PNG-like format in .webp, otherwise use the JPEG-like format in .webp. WebP at quality < 100 will destroy text, sometimes worse than JPEG, because VP8 can't store color at full resolution. WebP at q=100 will blow up photo sizes by orders of magnitude, similarly to PNG.
AVIF and JPEG XL actually have ability to mix-and-match blurry and sharp compression modes within a single image.