Why `distinct` and `count` operations generate `"op": "command"` in system.profile
Originally, all database operation in MongoDB are encoded in the Wire Protocol. However, this would mean that creating a new command would involve:


Creating a new opcode in the wire protocol, and
Bumping the wire protocol version.


Another disadvantage with this approach is that the format of the opcodes cannot change without changing the wire protocol version. As more features are introduced, this situation will become unavoidable and potentially occur more often in the future.

To overcome this limitation, newer version of MongoDB started to migrate the existing wire protocol functions into its command form. For example, the command forms of the CRUD operations are detailed in the Query and Write Operation Commands documentation page.

This is the main reason why some operations are recorded as commands, and some are recorded as the actual wire protocol codes. Eventually, the command forms will be the preferred form in the future.

There is no single generic ticket that describes this move, but the DOCS-7489 ticket kind of describes the process for the drivers.

For a more in-depth technical details on upcoming driver changes with regard to the wire protocol, please see New Driver Features for MongoDB 3.6, specifically the section about OP_MSG.