Modular derivations for extensions of Poisson algebras