This is not as straightforward as it may seem.
First of all, it's a real biotch to disassemble the 2017 iMac and then reassemble it. I've done this on my 2010 iMac, but I'm not going to do the same with my 2017. The 2010 is much easier, but I wouldn't categorize it as exactly "easy".
The drive interface is proprietary but you can get a US$3 adapter that allows the use of a standard third-party M.2 MVMe SSD. The issue though is at least with the MacBook Pros, some OS upgrades require the OEM SSD for firmware updates. If the OEM SSD is not there, then the OS upgrade fails. Also, recovery mode doesn't work. I'm not sure if it's the same with the iMacs, but you should look into it first before going down this path. Also, some people have run into sleep issues with third party NVMe SSDs as well as other problems.
I'm not sure what happens if you install a 2.5" SATA SSD instead as the boot drive and take out both the original SSD and hard drive. My guess is this could be a problem because of the firmware update issue above. I do know that occasionally third party 2.5" SSDs have disappeared in the OS though.
For the lazy, I'd consider just using an external USB-C boot SSD, or else an external Thunderbolt 3 SSD.