bcachefs with foreground_target/background_target/promote_target set appropriately does this automagically: https://bcachefs.org/Caching/
Overall I'm happy enough with Unraid for the moment, but I will definitely check in on bcachefs-based solutions when I'm next considering a rebuild/upgrade.