I voted to close that question (Running script over every file in folder using GDAL in Python?) too, and for the same reason that you cite. It's only answer seems to reinforce the point you make about it being a pure Python question because no mention of GDAL or any other spatial Python library was needed to answer it.
The question was later flagged with this text attached:
I feel this was wrongly put on hold. The question is clear and
concise, contains a question involving remote sensing and python, and
from I've read on what's appropriate for this site it seems to fit the
bill.
and the processing of that flag has led to it being re-opened.
Personally, I would have dismissed the flag with a comment like:
The question is clear and concise. It mentions GDAL, and has been
asked by someone doing remote sensing, but the question distills to
"How to process every file in a folder using Python?" and as such is
better researched at Stack Overflow. If you need to ask a question there be
sure to trim the GIS-specific aspects from it because you will be
addressing IT rather than GIS specialists.
In retrospect, as a moderator, before I voted to close, I think it would have been better for me to have made a comment (like that above) so that the asker had more information about why I was voting to close.
This is an example of our community being unsure as to Where is the line between Python and GIS?