This is probably the first introductory usage of p4 I’ve seen. Neat!
Not sure if this is the right approach. Notably, I don’t think you should mangle routing and switching. Switching have a learn phase while routing does not. Moreover, routing needs to update the source MAC address as well.