The quick write up is a PWM pulses the given voltage, a Buck steps the voltage down.
To use that 40v and convert the voltage down to 12v you'll need something like this: https://www.amazon.com/360W-Converter-Voltage-Regulator-Waterproof/dp/B07J274LZD/ref=sr_1_17?crid=2A702L5QCMQ89&keywords=40v+to+12v+converter&qid=1653488729&sprefix=40v+to+12v%2Caps%2C101&sr=8-17 Here's the negative, 30a is the max draw and they aren't well known for being able to provide that constantly.
My personal opinion but the added components and decreased reliability are not beneficial for the charging ease. Especially if you're trying to keep the RC Functions.
If you want to keep RC functions and increase speed you can change the weelye controller out for a 24v and put two SLA in series. The control board will be rated to handle the voltage and you should retain all other functions. This is the most reliable in my opinion.
The next most reliable is to ditch RC functions and create your own wiring harness similiar to a Power Wheels one, that relies on pedal and shifter switches that can handle 18-24 volts easily. I usually take a old power wheels harness and graft it onto the kids ride on.
At some point the need for speed will exceed all of the stock capabilities you have and it will have to be custom.