WIll it mess with the electronics for the ebike part of my bike if I install a larger chainring on it?
You also have to worry about chainstay clearance when upsizing a chainring, and drivetrain efficiency and wear rate when downsizing your smallest rear cog.
You're looking at a 14% increase in ground speed from 35 to 40 kph. That means a chainring with 14% more teeth and therefore 14% larger diameter. Or a 13% smaller rear cog.
As
@m@Robertson noted, with a hub-drive, you have to keep up
wheel speed — and therefore ground speed — to keep up motor efficiency. The more efficiency you lose, the less mechanical power out per watt of electrical power in.
So the more you let a hub-drive bog down on a hill, the less assist you'll actually get, the more the motor will heat itself instead, and the harder you'll have to pedal to keep from losing even more ground speed.
A larger chainring might help you mitigate that by hitting the bottom of the hill at the highest possible speed. But by reducing all your gear ratios at once, it might also compromise your ability to finish the climb with available leg power.
If your routes involve steep enough hills, that might push the trade-offs toward a cog-based solution.
I recommend getting your bike shop involved.