It would be information for astronomers to specify how close a Sun-like star would have to be for today's telescopes and astronomical sensors to be able to detect an Earth-sized planet orbiting that star at the same distance as our Earth orbits the sun. I suspect it's not more than a dozen light-years at best.
Furthermore, habitability has more complex requirements than just an Earth-sized planet at a liquid-water-sustaining distance from a suitably-sized star.
I agree that the detection of significnt fraction of oxygen molecules (and not just oxygen as CO2) in an Earth-sized exoplanet's atmosphere would almost certainly indicate the presence of (at least photosynthetic plant) life.
It's important to note that not a single habitable planet beyond Earth has been discovered. All they've discovered is potentially habitable ones. And the only criteria being used for that is estimated temperature and mass of the planet. There are certainly a lot of other factors, as you've pointed out.