REST page content upload with multi language support - language is set to None

We are writing a migration tool from FOSWiki to XWiki. In our old FOSWiki, we have pages in multiple languages: German and English, with German being the main language. We therefore have configured XWiki to use German and English language with German as the default language.

Our migration tool uses the XWiki REST API to upload the created pages.

There seems to be something off:
The language specified when uploading is ignored sometimes.

In order to create a page, we send following the following XML to the URL https://somedomain.lol/rest/wikis/xwiki/spaces/Informatik/spaces/Helpdesk/pages/Accountverlaengern/

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>                                                        
<page xmlns="http://www.xwiki.org">                                                                            
  <id>xwiki:Informatik/Helpdesk.Accountverlaengern</id>                                                        
  <fullName>Informatik/Helpdesk.Accountverlaengern</fullName>                                                  
  <wiki>xwiki</wiki>                                                                                           
  <space>Informatik/Helpdesk</space>                                                                           
  <name>Accountverlaengern</name>                                                                              
  <title>Accountverlaengern</title>                                                                            
  <parent></parent>                                                                                            
  <parentId></parentId>                                                                                        
  <version>1.1</version>                                                                                       
  <author>XWiki.Admin</author>
  <authorName>Unknown</authorName>
  <xwikiRelativeUrl>https://somedomain.lol/bin/view/Informatik/Helpdesk/Accountverlaengern</xwikiRelativeUrl>
  <xwikiAbsoluteUrl>https://somedomain.lol/bin/view/Informatik/Helpdesk/Accountverlaengern</xwikiAbsoluteUrl>
  <syntax>xwiki/2.1</syntax>
  <language>de</language>
  <majorVersion>1</majorVersion>
  <minorVersion>1</minorVersion>
  <hidden>false</hidden>
  <created>1970-01-01T00:00:00+00:00</created>
 <creator>XWiki.Admin</creator>
 <creatorName>Unknown</creatorName>
 <modified>2022-04-21T13:30:57</modified>
 <modifier>XWiki.Admin</modifier>
 <modifierName>Foswiki Migration Bot</modifierName>
 <comment>Imported from foswiki</comment>
 <content><![CDATA[my awesome page full of content about Accountverlängering lol]]</content>
</page>

After this succeeds, we send the same XML request to the same URL but with the <language> tag set to en and the content in English language.

When we now take a look at the resulting page we have a page translation in English but the original locale of the page is set to None and contains the German translation. It does not matter which translation we send first, it is always the German one that gets “stripped” of its locale (i.e. locale is None).

This is a problem because when a wiki user changes their preferred language in global language preference (the top-right menu), you can only select English there, but not German.

Am I doing something wrong here?
What is the correct way to upload and create localized pages via the XWiki REST API?