I don't understand why this is so complex? Just make it a feature you put in Cargo.toml:
serde = { version = "1.0", features = ["serde_derive", "fast_compile"] }
Either opt-in or opt-out is fine. It's surely useful during development but it shouldn't be on for production builds. Any transitivity issues should be considered problems with the dependency.