How does a generic bluetooth mouse / keyboard work with macos without installing any driver?
Yes. It's the generic  USB HID (Human Interface Device) driver/kext or Bluetooth HID profile
All operating systems have a generic HID driver  so that USB and Bluetooth keyboards, mice, and track pads will work out of the box without the need for a manufacturer supplied driver. That said, specialized keyboards and mice like those used for gaming, for example, will operate as  a generic device but, to use the  specialized functions or extra buttons, you'll need the manufacturer driver.