Regarding your war
Castille/Siena likely had sea control. An indicator for that is Siena troops in Spain to help Castille. They can only get those there on ships and for that they'd need sea control. This also allows Morocco to simply send troops via the stratis of Gibraltar. On the other hand, Naples can't get troops to Iberia, because their transport ships would have been sunk by the spanish navy, so they couldn't help.
Forts act as blockers. Armies can't move past provinces adjacent to forts. It's likely the spanish fort network was dense enough, that Aragon couldn't help you, as they couldn't move troops past the forts. Again, due to sea control in the hands of the enemy, they were unable to send troops to battles via ships. So they did the only thing they could: Siege Forts to open up avenues of attack.
Regarding Frances Intervention
This likely was just France taking an opportunity where they saw it rather than having any interest in helping you in your war. Any direct intervention into your war, e.g. via enforce peace would have brought in France as an ally on your side.
You stated the war lasted 8-10 years. Any nation is pretty down after such a long time. Considering how badly the war seemed to go, it's amazing you even managed to survive for that long. Castille was as weak as you were and France just used the opportunity to swoop in and take a couple provinces from an enemy who can't defend themselves. This may not even have been Castille, it's possible France launched another war into which Castille was brought in (possibly vs Siena).
Check the ledger to see the name of the war, to get an indicator what it was about. I also highly recommend you turn on pop-up notifications for war declarations and peace treaties of nations important to you. If you had, you would have both seen a pop up of France declaring war to Castille and the Casus Belii as well as the peace treaty between France and Castille with the agreed upon terms.
You can adjust the notification setting on the right side of the screen, above the minimap. The games auto selection of interesting countriesw is usually very good.
Your current situation
I'd hesitate to call your current situation a win. You are likely very highly in debt, due to maintaining a mercernary army for a long time. You still have to deal with rebels. Your manpower is drained, which means, you likely have to completely forego an army for a while. And what did you get out of it? Probably absolutely nothing, because you chose to help in an independence war, were the victors likely took nothing but their independence. So, you wasted 10 years in a war, which devastated your country and economy. Damage, which will take 10-20 years to repair. In return you got two independent allies. Not a great deal at all.