In fact they did.
IRGC trained ground crews with Radars and TELARs to detect, track and "Illuminate" the targets. Even some sources recognizes that Irán was able to shoot down some active jammers (manufactured by Leonardo UK) called "BriteCloud".
The U.S. Navy is acquiring and undisclosed number of BriteCloud Active Expendable Decoys specifically for the F-35 Lightning II. The Naval Air Systems
theaviationist.com
BriteCloud is an active diversion system. You launch it to confuse the enemy and turn his focus elsewhere.
And we saw that Iran could track 4th Gen planes via video footage they released, but due to EW could not target them.
So, we have some rumors that Irán was able at least to detect and track 5º gen aircrafts during 12 day war.
“Rumors”
Also detecting a F-35 is not the same thing as being able to target lock onto it.
The exact technique and weaponry used to track them is unknown (IMO the best candidate would be Arman TELAR system, the newest and all in one vehicle SAM system incorpored).
Arman is a prototype, with no evidence anything more than a single battery group exists. It would likely be used in defense of Tehran not all the way in the south.
If using these assets (F22, F35 and B2) were easy for sure US would no waste more time involed in a deal.
I don’t think you realize how radar cross section works. Iran is not able to target lock an F-35 until it’s maybe 50KM a way from radar source or an F-22 until it’s 25KM away. This is ideal conditions. If the other side is using extensive jamming techniques and diversion tactics that’s another story. If the other side gets illuminated at a bad angle that works in Iran’s favor.
So for F-22/F-35 they merely have to keep this in mind and use stand off PGMs from 35-50KM away when they attack Shahid Solemani vessels and Kharg Island AD/Radars, after which the PG becomes relatively unguarded. The tomahawks from destroyers and carrier groups will attack radar spots and AD points near Iran’s shore and coastline.
After that is done than the planes have breathing room to fly even closer to Iran and then USAF can bring in more 4th Gen fighters to do sorties in the strait with F-22 providing protection. That will leave the speedboats and small surface vessels very vulnerable as you saw with how drug cartel speedboats did trying to evade the U.S. fleet around Venzenula.
The reason Us hasn’t attacked Iran till now is a combination of reluctant presidents and the proxies Iran had (Syria, HZ, Hamas, Houthis, Iraqi PMU), most of the groups are gone or severely weakened. Iran still retains considerable sabatoge capability. But against 300+ fighter jets flying 24/7, Iran’s IADS will not survive long and likely completely collapse within a week or two.
That is one reason I advocated for S-400/S-500 purchase and additional air defense purchases from Russia/China because I knew Iran’s air defense rings were still not saturated enough to go up against an opponent like the U.S. and that Bavar/Arman needed more time to get rate of production going.