2017 iMacs do not have T2 security chips or Apple Silicon processors. So as far as I know, they do not support Activation Lock.
My guess is that you have encountered a firmware password lock (Set a firmware password on your Mac - Apple Support). That lock kicks in when you start up from any disk other than the designated startup disk. Erasing the designated startup disk and reinstalling macOS would probably count as a change which would bring up the lock screen (if a lock was set). Intel-based Macs do not have firmware passwords enabled by default – so somebody (you?) would have had to explicitly set a lock.
The only ways to remove the firmware lock involve
- Providing the requested password so you can get to the security dialog that would allow you to disable it, or
- Presenting the Mac and the original invoice or receipt to Apple or an Apple Authorized Service Provider
If you have neither the password nor proof of original purchase, the Mac will remain locked.