Historically, OpenFirmware provided exactly what you were asking for — self-describing devices, device driver methods hanging off the device nodes, and portable, architecture-independent bytecode-based option ROM drivers on expansion cards.
Devicetree is a paired down version of OF; they retained the tree containing key/value device metadata, and dropped all the good bits.