Language switcher using get language variable instead of prefix in Drupal 8
The plugins you enable in the language detection configuration also contain the methods to build outbound paths and the language switcher links. The plugin for Url adds prefixes, not query strings. Others do, for example Session for anonymous users, so you probably have enabled a second detection method.