T-duality and exceptional generalized geometry through symmetries of dg-manifolds