Mongo Playground

Configuration

[{name:"test",email:{"firstname_lastname1@gmail.com":{field1:"test"},"firstname_lastname2@gmail.com":{field1:"test"}}}]

Query

db.collection.aggregate([{"$addFields":{"email":{"$objectToArray":"$email"}}},{"$addFields":{"email":{"$map":{"input":"$email","as":"e","in":{k:{"$ltrim":{"input":{"$reduce":{"input":{"$split":["$$e.k","_"]},"initialValue":"","in":{"$concat":["$$value","_dot_","$$this"]}}},"chars":"_dot_"}},v:"$$e.v"}}}}},{"$addFields":{"email":{"$arrayToObject":"$email"}}}])

Result