There are plenty of patterns for cotton masks online and I think ways to use a 3D printer to make one. I would much rather just buy one, myself.
I know nothing about 3D printing, so if you do you might want to search and see if what you find looks workable. I got many results that indicate it is possible.
“Cotton masks” from Etsy are almost certainly not the same thing as the medical/operation/surgical masks being suggested, which typically have a melt-blown polymer filter layer between non-woven fabric exterior layers.
It's true that even medical providers are turning to these type of masks as emergency supplies (and calling on hobbyists to make them for medical use!) because actual proper surgical masks are in short supply, but that doesn't mean that they are as effective and, moreover, it means that mass public use would lead to supply shortage into what has become the necessary fallback for actual medical use.
Why is Japan an outlier? One thing they do differently from most of the rest of the world is wear masks. Not perfectly but certainly more than in the US. And many Japanese are making their own now as they can't find professionally made ones either.
Yes it's a desparate measure but this is becoming more serious by the day.
I did have the opportunity to ask a Japanese person his opinion on why the rate of increase is lower than in the US. One reason he gave is wearing masks. Another one is the practice of taking shoes off when entering one's home (you bring in fewer pathogens that way). He did preface his answer with the statement that he is not a medical professional and that he was stating that it was his opinion only. But maybe something to consider.
Editing to see that the question I answered might suggest that I was saying those types of cotton masks are medical grade. I didn't mean to suggest that and agree that it's not responsible for someone to use a medical grade mask now without a medical need. My apologies for any misunderstanding I created.
But it arrived in the US two days. It wasn't overnight shipping or anything fancy or expensive either. I was expecting 5+ days.