You can ask for holiday at any time. You are an employee, not an indentured slave, and have a right to take some amount of holiday each year (this will be specified in your contract and/or local law). You can always ask to exercise that right.
Your employer may have the right to refuse that holiday. Depending on your industry and company, your contract may say that your request may be declined (e.g. most retail employees cannot get time off at Christmas), or not allowed during specific periods (which may include probation). This would be unusual in a software company, but not unheard of, and in your circumstances it's more likely than otherwise - if your probation is extended by a month and you spend half of that on holiday, it doesn't give you much time to show them what they want to see. This does not prevent you from asking, though.
There may be a minimum notice period required. For example, most places I've worked have (formally or informally) expected twice as much notice as days off, so for 2 weeks holiday you'd need to request it 4 weeks in advance. Check your contract to see what applies to you. If you are truly burned out, then working another 4 weeks before you can take 2 weeks holiday may not be helpful.
Holiday is the least of your problems. You don't mention how long your probation period is, but three months is typical (though my current company had six). If, within just a few months, you are "unable to work or focus" and "have 0 motivation" and are under "stress" and "cannot work due to burnout", I find myself wondering whether this is the right job and/or company for you, and I completely understand why you may be in danger of failing your probation.
Your performance is under scrutiny. You mention that you are worried that asking for holiday will lead to your getting fired, but I would suggest that not doing the work that you are asked to (as you say you are unable to), during a period when the company's attention is closely focused on your performance, may also get you fired. While it is possible that the company might be extending your probation because they unethically want to treat you as a temporary employee, it is also possible that they are being generous in giving you more of a chance than you deserve based on what they have seen so far. Do the job well or expect to lose it.
If you do lose your job, excess holiday may be deducted from your final pay. Check your contract for how this might apply to you, but if (for example) you are allowed 20 days holiday per year, but are only at a company for three months, then any holiday over 5 days may be deducted from your salary.
If you genuinely feel that a period of holiday will help you to recover from burnout, regroup mentally, and come back to the job ready to amaze your employer with what a great job you can do, then yes, you should request the holiday and (if asked) explain exactly that. Then, make sure you deliver.
On the other hand, if you look at yourself honestly and realise that you would come back from holiday and still not be able to deliver what your employer is asking for, then asking for the holiday would be a waste of time. Is 1 or 2 weeks holiday really going to turn everything around, in a way that a weekend wouldn't? It's possible that it might, but it's also possible that 2 weeks might not be enough, or that holiday isn't actually going to solve anything for you at all. I do not know you or what is really going on inside your mind, but from what you say here, I suspect this is more likely. In that case, you're going to need to find a way to demonstrate you can do the job - or find a different job.