Unity adds unwanted packages

I run a build locally and on a Gitlab CI. The local builds fine but the CI build keeps adding unwanted packages to the build:

  com.unity.ads@3.7.1
  com.unity.analytics@3.3.5
  com.unity.collab-proxy@1.6.0
  com.unity.modules.ai@1.0.0
  com.unity.modules.cloth@1.0.0
  com.unity.modules.terrain@1.0.0
  com.unity.modules.terrainphysics@1.0.0
  com.unity.modules.tilemap@1.0.0
  com.unity.modules.uielements@1.0.0
  com.unity.modules.umbra@1.0.0
  com.unity.modules.unityanalytics@1.0.0
  com.unity.modules.unitywebrequestaudio@1.0.0
  com.unity.modules.unitywebrequesttexture@1.0.0
  com.unity.modules.vehicles@1.0.0
  com.unity.modules.video@1.0.0
  com.unity.modules.vr@1.0.0
  com.unity.modules.wind@1.0.0
  com.unity.modules.xr@1.0.0
  com.unity.multiplayer-hlapi@1.0.8
  com.unity.purchasing@3.2.2
  com.unity.test-framework@1.1.27
  com.unity.textmeshpro@2.1.4
  com.unity.timeline@1.2.18
  com.unity.xr.legacyinputhelpers@2.1.7

Those packages are not in the manifest.json. Any ideas why that might be happening here?

As it turns out the ProjectSettings/ProjectVersion.txtfile was missing and when that happens Unity will assume that the project was previously run on an older version of Unity and will run an update which causes Package Manager to add some packages.