Replace device in active RAID0 MD array

I wish to replace a drive in an active (working) RAID0 MD array, without taking it offline. The data inside isn’t important (which is why it’s RAID0), but I don’t want the downtime of an offline replacement

Per mdadm manpage, it’s possible to convert the array to RAID4 and back:

The Linux Kernel is able to convert a RAID0 into a RAID4 or RAID5. mdadm uses this functionality and the ability to add devices to a RAID4 to allow devices to be added to a RAID0. When requested to do this, mdadm will convert the RAID0 to a RAID4, add the necessary disks and make the reshape happen, and then convert the RAID4 back to RAID0.

So I attempted to do this with some test disks:

# Set up test disks

$ truncate -s1G dev1 dev2 dev3
$ sudo losetup -f dev1 # loop0
$ sudo losetup -f dev2 # loop1 (to be replaced)
$ sudo losetup -f dev3 # loop2 (replacement)
$ sudo mdadm --create --level=raid0 /dev/md1 --raid-devices=2 /dev/loop0 /dev/loop1
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md1 started.

# Add replacement disk

$ sudo mdadm -v --grow /dev/md1 --raid-devices=3 --level=raid4 --add /dev/loop2
mdadm: level of /dev/md1 changed to raid4
mdadm: added /dev/loop2
$ cat /proc/mdstat 
Personalities : [raid0] [raid1] [raid4] [raid5] [raid6] [raid10] 
md1 : active raid4 loop2[3] loop1[1] loop0[0]
      2093056 blocks super 1.2 level 4, 512k chunk, algorithm 5 [3/3] [UUU]
$ sudo dmesg | tail
[3200705.124803] md/raid:md1: device loop1 operational as raid disk 1
[3200705.124810] md/raid:md1: device loop0 operational as raid disk 0
[3200705.125307] md/raid:md1: raid level 4 active with 2 out of 3 devices, algorithm 5
[3200705.125315] md1: array will not be assembled in old kernels that lack configurable LBS support (<= 6.18)
[3200705.191718] md: recover of RAID array md1
[3200710.540155] md: md1: recover done.

# Remove replaced disk

$ sudo mdadm -v /dev/md1 --fail /dev/loop1 --remove /dev/loop1
mdadm: set /dev/loop1 faulty in /dev/md1
mdadm: hot removed /dev/loop1 from /dev/md1
$ cat /proc/mdstat 
Personalities : [raid0] [raid1] [raid4] [raid5] [raid6] [raid10] 
md1 : active raid4 loop2[3] loop0[0]
      2093056 blocks super 1.2 level 4, 512k chunk, algorithm 5 [3/2] [U_U]
$ sudo dmesg | tail
[3200756.850422] md/raid:md1: Disk failure on loop1, disabling device.
[3200756.850428] md/raid:md1: Operation continuing on 2 devices.

# Convert back to RAID0

$ sudo mdadm -v --grow /dev/md1 --raid-devices=2 --level=raid0
mdadm: wait 5 seconds to give kernel space to finish job
mdadm: failed to write 'raid0' to '/sys/block/md1/md//level' (Invalid argument)
mdadm: /dev/md1: could not set level to raid0
$ cat /proc/mdstat 
Personalities : [raid0] [raid1] [raid4] [raid5] [raid6] [raid10] 
md1 : broken raid4 loop0[0]
      2093056 blocks super 1.2 level 4, 512k chunk, algorithm 5 [3/1] [U__]
$ sudo dmesg | tail
[3200784.820758] md/raid:md1: Disk failure on loop2, disabling device.
[3200784.820764] md/raid:md1: Cannot continue operation (2/3 failed).
[3200789.905946] md/raid0:md1: raid5 must be degraded! Degraded disks: 2
[3200789.905952] md: md1: raid0 would not accept array

The operation failed on the last step in converting back to RAID0, with the array ending up in a broken state. It seems like it tried to remove loop2 for some reason?

How can I online replace devices in a RAID0 array?