Is it legal/possible to apply for a patent based on an already published/submitted journal article?
Self-plagiarism is not the issue. The patent documents an invention. It is not a creative work itself. You could just stick a cover letter on your paper and submit that, in theory (as a provisional patent anyway). In practice, everyone says a patent that is not carefully written by a lawyer will be worthless. Lawyers especially tend to say this. However, different countries have different rules regarding copyright on the images used. So you may not want to reuse them if you transferred the copyright to a journal. 

Patents are required to be both non-obvious and novel. Your own publication can count as "prior art" proving your patent is no longer novel. This is also called a public disclosure, which usually means publishing or offering it for sale to others. Different countries have different laws regarding when you can patent something that has been publicly disclosed. The US gives you a year after publication. Many other countries give you no time; the idea can't be patented there after disclosure. Applying and submitting at the same time may work but you're right on the line there, so need to be careful in other countries.

https://en.wikipedia.org/wiki/Public_disclosure