Visio TV attached with HDMI to iMac zombie
Your TV is not actually turned off, it’s in standby.  And since many consumer electronics companies utilize the CEC signaling over HDMI so other devices can turn it on/off, the Mac is interpreting that it’s still on.

You’ll have to disconnect your Mac or turn off the monitor from the mains themselves.

Possible solution

I’ve been looking at a product from a Pulse-8 that claims to have a USB CEC adapter that allows you to control the CEC signaling from a computer.  I haven’t tested it for a number of reasons not limited to many other projects, proximity of my iMac an my living room TV, priority, etc.  However, since it “intercepts” the HDMI signal and overrides the CEC signaling, it may solve the problem.  I’m not saying it does, but it may be worth looking into.

Additional solution - there is an “HDMI CEC-less” cable that doesn’t have the CEC signaling pins - this too, could solve your issue.