Use external USB 3.0 SSD with 2012 iMac for the OS?
Yes, it's totally fine to install and run macOS on an external HDD/SSD.

Especially since USB 3 you can get the same speed as the internal drive – or even faster in the case of an SSD.

The only downside is the fact that you will have one USB-port permanently occupied. It may also not be as pleasing to one's eye if there's an external drive permanently attached.

Enjoy your new iMac!