Fix brew list when combining --pinned and --versions

Fixes #32067 and closes #32099.