You should never use /dev/mdX in crypttab or fstab – these paths are not guaranteed to be stable and can change even between two reboots (same applies to /dev/sdX). Always use unique identifiers like UUID=<uuid> or stable paths like /dev/md/<name> in config files.
but rather that it is not guaranteed to be stable.
Using the UUID is (almost 100%) guaranteed to never change by itself, while the device name seen during config while booting may change as you encountered.
In my experience, if you define an array as md0 when first defining it the name seems stable since it is written into the array metadata on the drives. If you allow it to be defined by default that name is not written into the metadata and is created at boot time. (It seems md127 is the default for the first array created on a system.) The hostname and host machine id seem also part of the array metadata and may cause problems if the array is moved to a different host if not exported on one host then imported to the new host as well.
Note that the name contains the name of the host where the array was originally created even though the host using it is different. The name is contained in the array metadata.