Non-copyleft code already explicitly allows itself to be included and distributed under different licenses. Even closed-source programs are allowed to contain OSS-licensed code as long as the proper attribution and legal notices are preserved. The first TCP/IP stack for Windows was ported from one of the BSDs, and shipped as part of the proprietary OS; does that count as a "relicensing" of the original code?

Taking a look at the official license text, the AGPL makes an explicit distinction between the license on the work as a whole, and specific licenses covering parts of the source: https://www.gnu.org/licenses/agpl-3.0.en.html

> 5.c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged

Emphasis mine. This does indeed refer to the work as a whole, but it also allows for specific exceptions. Section 7 makes two interesting claims:

> If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.

So if parts of the source code are under the Apache license (which grants additional permissions beyond the AGPL), those permissions remain valid when used outside the AGPL-licensed work.

> When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it.

So yes, it appears you are not required to preserve these additional license freedoms when distributing the source code. But this claim is immediately followed by an enumeration of the standard OSS clauses - right of attribution, preservation of legal notice, and disclaimer of liability - so all the legal requirements posed by the original license are covered.

So if Ubuntu were to choose to do so, it is free to remove the Apache 2 license (but not its legal notice, for that it needs permission from the original copyright holders) from any copies they distribute, and still be compliant with the original license.

because it is obviously contrary to the purpose of the AGPLv3

It isn't contrary to that license: the purpose of the GPL (and by extension, the AGPL) is to ensure that the source code remains free. It does so by imposing additional restrictions on distribution on top of what is required by MIT/BSD/Apache licensed code. Removing clauses that allow to take (parts of) the code and make it proprietary isn't contrary to the purpose of the AGPL -- it is however contrary to the (supposed) intentions of the original copyright holders who presumably chose their license for a good reason.

Note again that this isn't really different from what the GPLv2 allowed to do (from https://www.gnu.org/licenses/old-licenses/gpl-2.0.html):

> 2.b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.

I remember this same discussion happening 20 years ago with the players being the Linux kernel and *BSD driver code; strictly speaking, Linux developers could take BSD driver code, preserve the legal notice, and distribute the complete code under GPLv2 and still be compliant with the BSD license. In practice, people honoured the original license and I'm sure you can still find dual-licensed BSD/GPL parts in some places in the kernel tree.