And the answer is:
To enact the ordinance as soon as you can as YOU are responsible for installing and purchasing all smoke detectors for every existing building in your city. That will counter the high cost of the smoke detector ordinance. If you wait until you have 20k population YOU the mayor will have to pay for every smoke detector and their instillation.
Do it soon and pay less
Wait until you have a larger city and pay more!
THAT answers that question
Your suggestion seems flawed, but I have no evidence to counter it at the moment without further testing. Do you have proof of your suggestion? Have you tested it? There is no in-game text that says this. I would perhaps suggest that you do not take someone on YouTube's word as the ultimate truth. Did they just say that's how it works, or did they prove it? Sometimes they do get it wrong, and there's no shame in that. If you could provide a link to the testing that will help us understand.
Of course it's cheaper to put smoke detectors in a 5k city than a 20k city. It is very easy then to not notice the increase when your city grows to 20k from the 5k as you're used to it.
So essentially what you're suggesting is that if you have a city of 5 houses and you enact the policy and then the city grows to 10 houses the cost of the policy will not increase or double?
This will be easy to measure in a test and I intend to have a go at this later and record it. I would suggest that the cost of the policy will be the same whether you enact it from the beginning and you have 10 buildings, or enact it AFTER the 10 buildings are built.
If anyone wants to do the test independently, I would be happy to share results and if I'm wrong I will be more than happy to concede the point to you

. I am only after a scientific result and as part of that I'm happy to make mistakes, learn from them and change my views.
I would also like to suggest that your argument is not the only way as the issue of tax and budgets is a complicated one. We could debate what is the best way to reduce buildings burnt down, but that is not what the OP has asked. Really, in my cities I don't use the policy as my fire coverage is excellent.