Yes... I think you got the general gist of how it works.
As you said... there is a balance of defending and bringing more lethal power to bear against the enemy. Killing the enemy can actually be more effective than tanking their hits with good armour for example. In my tests above fir example using infantry with regular weapons was far more effective then using troops with PWL weapons as they managed to kill the enemy faster then my heavy weapons could inflict damage in the enemy heavy units, this managed to save the heavy weapons more effectively as I had both a great meat shield and decent killing power against the enemy infantry.
The main difference between PWL and PW infantry is that PWL will make you last longer but you might not be able to defeat the enemy, especially if they bring lots of heavy vehicles. But at the same time heavy vehicles will be highly inefficient at killing the militia. In these instances your role have to be to act as a delaying action rather than directly beating the enemy. The heavy weapon emplacement is there to slow down the attrition not really to stop it. It is now up to you to muster a counter attack with sending a relief army and the job of the garrison to hold out for as long as possible. If you hold out long enough the enemy might run out of supplies too.
Infantry with PW or PWL weapons will have the same weight for the same cost but regular infantry will take less effort to remove by a superior force. This is the raw strength of lightly armed infantry. As soon as you start to put armour on them they will cost allot more and you will need to pay more to cover the same weight, but this should be less of a concern in an invasion army as you are now relegated to a certain size so making the infantry as resilient as possible for the weight they occupy become efficient to do. You can imagine the scenario that one of your colonies are invaded and you have a sizeable garrison there but not enough to defeat the enemy but you might be able to hold them off for three to four weeks. If you have 500.000t of troop transports available within that distance you want to bring as much firepower and resilience as you can, there is no time to build a new ship or bring those on the other side of the empire along as time will not allow it.
How much infantry versus other weapons is I think up for debate... but I usually go with a few doctrines in my own game.
For pure defence such as populated colonies I want roughly my front-line to be 2/3 infantry and 1/3 other formations from a size perspective. This will usually give you a rather high durability and a decent amount of heavy weapons to at least slow down an aggressor. From my recent tests that is infantry with PW in LA.
For pure delaying garrisons I would use more like 3/4 infantry to heavy equipment, these would be important mining operations or military outposts and be mainly PWL with LA. Heavy weapons would mainly be static with CAP and LAV weapons and nothing else.
For any large and important population I would build a more complex army with the ability to actually counterstroke anyone who try to invade with the purpose to be able to defeat an invasion and last very long. The army should probably be 3/4 defensive but if there is momentum I want some medium and heavy vehicles to attack with. These armies probably could be like somewhere between 50-60% infantry. These armies can also be used as reactionary forces to be moved into hot spots as they should be highly capable for their cost.
Any attacking army probably need much less infantry but I would probably not go lower than 30%, I'm likely to land somewhere between 30-50% for an offensive army with my infantry being pretty well armed and armoured as I will be dropping them into enemy planets. The downside with these armies are their cost... they will be extremely expensive for how effective they really are so I would never build my entire civilisations army on them but rather they would be more like special ops armies build for specific purposes.
For boarding purposes there is almost no reason not to bring the most expensive infantry you can build as the combat space is allot more restricted, as are the weapons that you can bring.
In terms of static versus vehicle then the ability to fortify a static unit to level 6 is allot more effective than the 0.6 evasion of a light vehicle. 0.6 evasion is equivalent of fortification of 2.5. A light vehicle actually can only self fortify to 2 so are more efficient on the attack if they can't fortify more than that. The fortification level also assume that you fight more or less on a barren or similar planet. You can get allot better fortification levels on some other planets.
A simple CAP emplacement (Static, Light armour, CAP) weighs and cost twice that of a similar infantry but have 30HP instead of 10HP. You have to view these as more or less infantry that is simply harder for other infantry to kill. There are usually not enough LAV or other heavy weapons in enough numbers to make up for the difference and if there are then infantry weapons might not be of much use anyway. LAV weapons will also be an expensive option to take them out to, you need about three LAV infantry for a same level fire-power against each other so they are both bigger and more expensive option as a single LAV infantry cost 0.32 (0.48 of CAP emplacement) and have a wight if 16 (24 for the CAP emplacement) and you need three of them.
For pure defensive purposes then these small pillboxes will be a problem for other infantry and they will not be expensive, roughly the same cost as five regular soldiers. A normal infantry will only have a 10% chance to destroy the CAP emplacement. If you bring allot of CAP emplacement on a defensive world I might be inclined to take some of their weight allotment from the infantry part, at least half of it.
Armour on statics is an oddity in my opinion as armour on them is rarely useful. Armour are mostly for when you have some form of space constriction... so that would only be for assault armies artillery as they will rarely bring static in any front line duties.
Anti-vehicle weapons used in defensive armies should be brought with no armour. Start with placing them in the rear echelon and only bring them forward once you see the enemy force composition and you have used enough attrition on their infantry, then bring them forward in full force and they will have a much higher chance to target a vehicle before they are themselves killed. There is no reason to have your artillery killed by enemy infantry while they mostly snipe infantry themselves, that is highly wasteful. I learned this in my recent testing...
...I could turn a loss into a win this way.