Yes, as soon as you know the references of the two documents, you can very well do both writes in one batch, as follows (JavaScript SDK):
const db = firebase.firestore();
// Get a new write batch
let batch = db.batch();
// Set the value of 'Doc1'
const doc1Ref = db.collection("col").doc("1");
batch.set(doc1Ref, { foo: "bar" });
// Set the value of 'Doc2'
const doc2Ref = db.collection("col").doc("1").collection("subcol").doc("2");
batch.set(doc2Ref, { bar: "foo" });
// Commit the batch
batch.commit().then(function () {
// ...
});
Actually, from a technical perspective, the two documents are totally independent of each other. They just share a part of their path but nothing else. One side effect of this is that if you delete a document, its sub-collection(s) still exist.