Transactions appear as applyOps oplog entries. To allow transactions to include both commands, such as index and collection creation, and other operations, ensure that the entire transaction is applied as a single batch, and ensure that the operations inside this batch are applied serially. The latter goal can be accomplished by changing the logic in OplogApplierImpl::fillWriterVectors to make sure that a single writer worker is used to apply the operations in the batch.
To ensure the entire transaction is applied as a single batch, we can either parse the entire oplog entry as part of the check for whether it must be processed individually to check for commands inside of transactions, or add information to the oplog entry to signify that it is a transaction with a command. The former may have be a slight performance hit due to the extra processing, but the latter is more difficult to implement. Provided the performance hit is not too high, the former solution is preferable.