This is a POC plugin that allows plugins to register custom names on top of entities. These entities are fully client side, and correctly sync between players.
CustomNameManager customNameManager = JavaPlugin.getPlugin(CustomNamePlugin.class).getCustomNameManager();
CustomName name = this.customNameManager.forEntity(player);
name.setName(MiniMessage.miniMessage().deserialize("<rainbow>%s</rainbow>".formatted(event.getPlayer().getName())));
For more information on the implementation details, see this gist.