You get legendary gear from few story missions, especially in the last act.
After the story is done, Veteran missions will be open to complete. They follow this pattern of missions:
1. Veteran Mission
2. Complete 3 side mission out of 4 available
3. Veteran Mission
4. Complete 3 side mission out of 4 available
You will only get Gear drops from Veteran missions themselves! Legendary weapon mods appear as random rewards from Side Missions. They are not guaranteed, you might end up with all 4 side missions only containing Epic rewards! Or you might get lucky and get 2-4 side missions all containing Legendary mods...
I would first do 20 Veteran missions required for veteran achievement, this should net you 60 side missions which hopefully will have decent amount of Legendary mods for weapons. After that you can cheese save scumming a bit, that you can also do on Ironman.
The save file for Xbox Game Pass version should be located at: C:\Users\YourWIN10Username\AppData\Local\Packages\Microsoft.GanderBaseGame_SomeLettersHere
Just copy whole folder for a save file.
What I discovered during my Trials is that you can effectively re-roll the rewards you get from a mission if you didn't get a mod you need. So all you need to do is copy your backup and overwrite you current save, to try again. Few caveats with this method:
1. The quality of rewards doesn't change, so no point trying this if all your side missions have Epic rewards.
2. The Legendary drop will always be for the same weapon! But, the slot will be random.
So if you targeting Gnasher for example, but got Longshot drops from the mission, there is no point for rerolling. You need to keep going until you get a drop for Gnasher.
This method helped me and saved lot of headache when I had 2 last slots left for this achievement.