Hypothetically, if Tom Cruise played a character named Tom Smith, that would count. Cameos or characters based upon their real lives would not. So neither Ray Romano in “Everybody Loves Raymond”, John Malkovich in “Being John Malkovich”, nor Topher Grace in “Ocean’s Eleven” would count.
They said that’s what they had to do on Taxi because they couldn’t get him to answer to his character’s name. Maybe he’s as dumb as they say and he still hadn’t figured it out by the time of Who’s the Boss?
Nobody’s going to mention I Love Lucy, or The Luci-Desi Comedy Hour, or The Lucy Show, or Here’s Lucy, or Life with Lucy? Did I forget any there? I don’t really think of those as based on the character’s real life. Not sure why the OP thinks Everybody Loves Raymond is based on his real life, I don’t think he was ever a sportswriter.
This would likely also disqualify comedians like Tim Allen and Roseanne Barr, who were also involved in the creation of their TV series, in which they played characters with which they shared first names, and which were loosely based on their standup comedy routines.