Is there a way to get 3+ dimensional array from a single MySql command

The direct answer to the question “Is there a way to get 3+ dimensional array from a single MySql command” would be yes, sort of – WordPress routinely stores and retrieves multidimensional data from MySQL rows by serialize()ing and unserialize()ing structured data to/from a string format, so it’s certainly possible using WordPress’s database interaction mechanisms. The Metadata API automatically handles this process when you pass it structured data, for example.

However, your question is rather something more along the lines of “How can I restructure database results into a custom format?”

The most “WordPress-y” way would be as you describe – use a WP_User_Query to query for users then re-arrange the results into your desired structure.

It may be possible to create a custom SQL query that formats the results as you desire but it seems counter-intuitive – relational databases are designed with a large emphasis on 2-dimensional data. Inquire over at Stack Overflow if you’d be interested in such a query. You can execute custom queries in WordPress using the parse_query() method of WP_Query.

To acquire a structure of users who registered within a certain year grouped by month of registration, I would do the following:

function wpse225632_get_users_by_reg_month( $year = null ) {
  $args = array();

  if( isset( $year ) )
    $args[ 'date_query' ] = array( 'year' => $year );

  $users          = get_users( $args );
  $users_by_month = array();

  foreach( $users as $user ) {
    $reg_month = mysql2date( 'm', $user->user_registered );

    if( ! isset( $users_by_month[ $reg_month ] ) )
      $users_by_month[ $reg_month ] = array();

    $users_by_month[ $reg_month ][] = $user;
  }

  return $users_by_month;
}

If you’ll be running this query frequently, you may wish to cache the resulting array using the Transients API, then invalidate the cache and delete the transient whenever a new user is registered.