Some brief reality check.
* Length of the border between Lebanon and Occupied Palestine: 79 km.
Length of the border between Iran and Pakistan: 904 km. Between Iran and Iraq: 1599 km, of which about a third is shared with the KRG, let's say 500 km (conservative guess).
Total length of state borders across which Iranian guards have been attacked by terrorists during past decades = upwards of 1400 km.
Do the math as to which of the two is easier to secure, other things being equal.
Then add to it the far more challenging topography of Iran's border regions in question.
Last but not least, HezbOllah isn't facing irregular forces but a classic conventional army. Attacks on HezbOllah border guards would therefore trigger large scale conflict between states, which is not the case of terrorist hit and run tactics against Iranian border units.
In short, we're talking apples and oranges. Any comparison in this regard is inoperative.
* Priorities. You do not start with neutralizing the much smaller threat posed by low intensity, infrequent instances of border terrorism. You first make sure to deter Iraq-style invasion by the world's so-called superpower. After which you make sure to deter Osirak-style air raids on critical infrastructure. Only then will you turn your focus on fixing remaining weak spots in border security.
The amount of funds made available to equip and train border guards therefore is not determined by the whims nor by the ideology of the Islamic Republic, but by level headed rational calculus.
* Quick but necessary reminder as to the respective defence budgets of Iran and her existential enemies, to put things further into perspective.
Iran: below $30 billion.
NATO: about $1000 billion. Zionist regime: $18 billion plus assistance from Washington.
To which the PGCC's aggregated $130 billion would have had to be added until recently. Some may perhaps choose to add Turkey's approximately $17 billion.
With this in mind it is easy to see why deterrence against the type of high intensity military aggression the USA and allies have the power to conduct, will eat up the bulk of Iran's defence budget. This translates into ample funding for the missile and UAV sectors, followed by air defences, fast attack craft and submarines and anti-ship missiles, as well as regional allies.
Even so, Iran is far from spending nearly as much on said allies as the usual discourse promoted by the zio-American media machinery is attempting to suggest, uncritically rehashed by the "na Ghazze na Lobnan" "regime change" elements.
A larger force like the PMU for instance is essentially funding itself autonomously via the local oil revenues.
When it comes to movements such as HezbOllah or the Palestinian Resistance, they are resorting to numerous parallel channels for funding. Iranian assistance is part of the picture but not all of it. And considering the size of these groups and the asymmetric nature of their military doctrine, the spending for Iran ends up not being all that high. These are definitely extremely lucrative investments in the geostrategic sense.
* Iranian border units have seen their equipment improve over time, if audio-visual and photographic reports published by Iranian media are something to go by. Kevlar helmets and body armor, standard issue infantry weapons, surveillance drones, superior sensors, communications devices, vehicles and building structures are being distributed among them step by step. It stands to reason that with this gear comes adequate training as well. Then again, Iran is a rather vast country with mountainous, hard to police borders. It naturally takes time until every unit is outfitted with the latest material.
This being said, the best weaponry and training in the world may reduce casualties but will stop short of eliminating these altogether. Especially if terrorist attackers based abroad benefit from intelligence and other types of support from hostile state actors.
Moreover, under certain circumstances terrorist cross-border attacks can be deterred through strikes carried out by other branches of the Iranian military. Case in point, Sepah's missiles hitting bases and outposts of separatist terrorist grouplets in northern Iraq.
Bottom line: at the broader level Iran has been acting in a logical way and making sound use of resources at her disposal. The notion that Iranian decision makers are driven by some sort of a fatal, counter-productive ideological preference for regional allies at the expense of Iranian forces per se, represents a typical propaganda talking point forged in the think tanks of Washington, Brussels and Tel Aviv with the express purpose of playing with the emotions of Iranian audiences and inciting them both against their country's allies and against the Iranian government, in the framework of the "regime change" read nation-wrecking agenda pursued by said foreign powers.