It always scares me when people automatically add -rf after typing rm no matter what they're doing. How do you even get into that habit in the first place?
"cannot remove 'foo': is a directory"
Just remove the darned object you're given as an argument using the appropriate implementation for its type.
"rm: remove write-protected regular file 'foo'?"
The rules are that if the directory is writable, the object can be deleted. Though you called stat to figure out it's a regular file, you didn't notice the link count: I have two more hard links to the file in the same directory, and one elsewhere. But, yes, unlink it.
I'd probably have that habit if I didn't once delete everything in a /bin directory early on in my learning, and luckily it was in a VM.