Flags in Mail app

Good evening from Wales, UK :wales:

Is there any way of using flags and their colours in the MacOS, iPadOS and iOS Mail App as a basis for automation, eg, if I mark an email with a red flag, then move it to an email folder called ‘bills’?

I’ve always assumed that this isn’t possible, but wondered if anyone knows differently or of a workaround?

Many thanks,