There are several schemas for how queries with/without sort are stored in system.profile. This makes it unnecessarily complex to run aggregation over system.profile collections that access the query patterns.
There should be a single common format for all queries.
simple find, no sort : query on top level
find with sort, query is nested in another query field, without $.
$query / $orderby syntax, results in nested $query field with $.