The code that is changed here was, and sill is, horrible: https://github.com/abgreeve/moodle/commit/1a1919412196174c7d967d3e5ba6037fe05147ee
There are two problems:
First, the way that the code is written duplicates complex logic that should be encapsulated in the fullname() function. I think a better approach would be:
And that code should probably be in a function in moodlelib.php next to fullname(), not inline in admin/user.php.
Second, what the code is doing is problematic. Sorting of users is meant to be controlled by users_order_by_sql in datalib.php, so it is consistent. So, parhaps admin/user.php should be using that function, and maybe that function should be talking note of the fullname setting, or maybe we should have a separate setting (on the same admin screen as the fullname setting) for default user sort order.
(In English, one would normally display Firstname Lastname, but sort on Lastname.)