When doing a line side tap, Can ground and neutral be tap before the main panel?
I gather the service panel is full, otherwise you'd just backfeed a 2-pole breaker there.
The junction box would have to be absolutely enormous because of the wire bending rules for such large feeder.
So how about killing 2 birds with 1 stone?  You might as well use a load center there instead of the junction box; not least, it comes with all the lugs you need and will provide the ground as well as breaker spaces for the solar and more.  Eliminating the need for all that stuff.  May even be cost-neutral or even cheaper.
For instance, I see plenty of 8-space panels with thru-lugs in the $140 neighborhood. At that point you install the solar breaker normally off a $10 breaker... and feed the old main panel off the thru-lugs.  You have also added 6 empty breaker spaces to the house for future needs, and taken care of picking up ground for the solar since this is now the main panel.