I am on the reverse journey. I went to art school, have been a designer for many years, and write software at a "not very good but I'm working on it" level.
How do you learn to self-critique? Honesty, objectivity, and taste.
Given your background, taste is the only one I'd worry about, but if you're shooting for photorealism, that's fine. You've got taste about what photos look like. That's easy. I'd bet that, after getting in the game, your goal won't be photorealism at the 5 year mark. But that's for later.
Here's Ira Glass, of NPR, with a fairly famous set of remarks about overcoming the period of time when you know what good art looks like, and know that the art you are making is not good: https://www.youtube.com/watch?v=X2wLP0izeJE
Another anecdote I've heard that's a favorite of mine and describes the process of becoming talented very well:
A pottery class is divided in two for the entire semester. One half of the class is told they have the whole 15 weeks to make one really, exceptionally great vase. The other half is told that their only goal is to produce as many vases as humanly possible, regardless of quality.
At the end of the semester, the vases that were aiming for excellence pale in comparison to those created by the half that was shooting for volume. Through the course of creating many terrible vases, the students learned what makes a vase good, and how to do it in fast, repeatable ways. You don't make the mistake on vase 20 that you made on vase 1. These iterations compound and lead to significant quality gains.
There are a lot of links to e.g. the lean startup methodology here. Fast iterations are better than long chunks of time spent chasing an ideal, because your ideal at the outset is almost certainly flawed in multiple ways that you won't realize until you've spent time trying to execute against it. Your ideas will fail in the world in ways you can't expect, so you want to put many ideas into the world and learn about the maximum number of failing cases.
Make as much art as you can, for as long as you can, no matter how bad it is. As long as you have ideas about what needs to improve, you can improve.