Motorsports will endure as long as we have user controlled vehicles, regardless of the manner of propulsion.
The thing that strikes me is that, disregarding autocross, racecars and streetcars are becoming more separated as time goes by. More airbags, things integrated into seats, radars, ultrasonic sensors, cameras, land departure warning, lanekeep assist, etc etc etc... Now, what will this lead to? Well, we are already somewhat seeing an increase in vintage racing, especially from the more grassroots side. Its just proving that the older, more simple cars are cheaper to buy/build/maintain. I am not really seeing what I eventually expect yet, or I dont have the insight into the market to observe it, but I am expecting a rise in built for purpose cars in the budget segment.
With usual street platforms needing more work to be a racing platform, its going to make more sense to start from scratch. I guess that will happen at some point. That point will probably approach as the simpler machines from the 90's start drying up a bit in availability.
Electric racing? Yup, gonna be a thing. If it motivates a vehicle, its going to be adapted into a racing chassis at some point. The lack of noise might make it less fun to watch, but it wont really make it that much less fun to drive. I would LOVE a crack at driving the VW IDR.
Now, autocross, well electric can ROCK in sprint formats like that, but yeah, sites might dry up a bit. It might be that we find out if theres a market to support sites like Kart tracks for lower speed car events, something where you average autocross and hillclimb. Purpose venue, lower the risk, possibly increased price to support infrastructure, but imagine being able to go do runs at a purpose venue on a weekday. Thats a possible future.
If theres a will, theres a way. I think there will always be a will to pilot a vehicle at the edge of a performance envelope. It will adapt.