I'm sorry for your plight. Slum Lords ought to be sentenced to life in their Rentals! Anyways, ...
First, you can in however way you can/want, tell the Landlord that you are 'afraid' that the tacks may cause harm to either you or your guests. I wouldn't use any words that might sound threatening like "... may poke a hole in my foot" or "... may be grounds for a lawsuit" or the like. Send the letter certified mail, return receipt along with the SAME letter to yourself. BUT, don't open the one you send to yourself. (That's for the lawsuit if it comes to that.) In short, I wouldn't take any matters into your own hands, even though you could probably hammer the tacks down. All that does is put a bandaid on the problem which REALLY is that you need that entire 'area' to be 'fixed'.
Or, you could leave the situation as is and give your minimum notice that you're leaving. Don't even mention why. Just tell him you found a 'better' apartment. Reason being that you say just that is because you may need him for a reference. Oh, I'd take some pictures from a couple of 'angles' for the record. You could even word your letter to include EVERYTHING that's wrong w/the unit. But again, don't use any words that sound threatening. In fact, state that you 'look forward' to having them fixed! If it ever comes to him giving you a BAD reference, show your prospective Landlord a copy of your letter. (NOT the letter you sent to yourself, certified mail, return receipt.) Use a separate one. This way, your prospective Landlord will see that you are a 'reasonable person'. You see, this is why it is good NOT to sound threatening to a Landlord. And when you write the letter, let it sit for a day and come back to it to see if you'd 'change' the wording any.
To answer your question directly, if the carpet is as frayed as you say, the tacks won't hold it for long if it will hold it at all. Yes, you can cover it with something but I don't know what since I don't know if what I suggest will allow the door to open. And yes, you could hammer the tacks down but, again, I wouldn't. You need to DOCUMENT your case (for court purposes to PROVE you gave the Landlord ample opportunity to 'fix' any problems.) Ample opportunity, IMO, would require at least 3 letters, certified mail, return receipt over 3 months. Then, at that point, if you really LOVE this place, then if you want, you could do what is REASONABLE to 'fix' any and all problems and then DEDUCT it from the rent. Assuming the 'bill' to fix the stuff is less than or equal to a month's rent, then you could do it all at once. If it's MORE than 1 month's rent, and if you have a security deposit, you have to consider that too. MAYBE all your fixes will include a month's rent and the deposit. Just keep that in mind.