it takes one to know one
The person who expressed criticism has similar faults to the person being criticized. This classic retort to an insult dates from the early 1900s. For example, You say she's a terrible cook? It takes one to know one! For a synonym, see pot calling the kettle black. A near equivalent is the proverbial it takes a thief to catch a thief, meaning "no one is better at finding a wrongdoer than another wrongdoer." First recorded in 1665, it remains current.