I've used the keyboards that came with MacBook Pros and iMac from 2009, 2010, 2012, 2015, and have tried the new 2018. Typing can feel different on the new thin ones with less travel. Still, I don't think it's anywhere close to a dealbreaker. To me the reliability problems of the recent keyboards are much more of a factor. If I could only have one device and needed to trust it to be reliable, I'd easily trust the iMac over the recent MacBook Pros. The Mid 2015 15" MacBook Pro is the last reliable model that I'd wholeheartedly trust.
As far as working on an iMac or a MacBook Pro, I much prefer the iMac. I use 27" iMac and 15" MacBook Pros at home. I tried the 21.5" iMac and I was impressed by it. The 13" for me seemed just a touch too small. If the device was going to be my primary and only device, then I would never consider the 13 inch. It'd always be the 15". If I was splitting between MacBook Pro and iMac, then I might consider the 13 inch.
I would not hesitate investing on the 21.5" 4k iMac at all. Upgrade to the SSD only storage and perhaps consider 16GB for RAM. I'd definitely put the SSD upgrade above RAM upgrade if you had to pick just one.
Another benefit of the iMac 21.5" over the 27" is that you'll have much less problems in finding a suitable desk and making it work ergonomically. You don't need much table depth for the 21.5" and can sit closer, and not run into font size issues. Regardless, iMacs are much better for neck strain than MacBook Pros as you don't have to look down. The bigger screen space will also be appreciated.