Team nick color does display when player joins, but not when it leaves.
[media]Code analysis
Mojang names:
net.minecraft.server.network.ServerGamePacketListenerImpl.onDisconnect(Component)
this.server.getPlayerList().broadcastMessage(new TranslatableComponent("multiplayer.player.left", this.player.getDisplayName()).withStyle(ChatFormatting.YELLOW));
I cannot reproduce this issue in 1.17.1, so my guess is that this was fixed sometime in the past. I've attached some screenshots and videos to support this statement.
[media][media]