If I get a new(er) iMac - which would run at least Catalina, could I also run El Capitan from a partition on the iMac hard drive or from an external drive?
I can't be sure of this Michael but I think it used to be the case that a Mac would not run an operating system older than the one that was current when it was released. As El Capitan was released in late 2015 (September), you'd need a Mac released at that time or earlier. Late 2012 iMacs will run Catalina but you'd need a 2014 one to run Big Sur. If I'm right, your ideal machine would be from 2015 so you could even go to Big Sur if you wish.
I know of no Mac released with a version of macOS able to run an older version other than using a virtual App like Parallels. (New drivers are often needed to support the new Mac).
Get hold of MacTracker to see which version of the OS your newer Mac can support.
Thank you both for your replies to my question. According to MacTracker a 2015 iMac can run all OS's from 10.11 El Capitan certainly to 10.15.7 Catalina and possibly Big Sur. So that is what I shall go for.
Incidentally MacTracker refurbs are not a great deal cheaper than Apple ones - and you need to add a keyboard and mouse!
Two places you can get refurbished Macs from are M. Resell and Hoxton Macs both places supply keyboard and mouse and come with a years warranty. I bought myself a late 2015 iMac from M. Resell last year and have been pleased with it