Just accidentally bought 240v g4 led bulbs and they obviously don't work in the 12v fitting i have. Is it ok to bypass the transformer and use the light fitting as a 240v direct to mains one that should drive these bulbs?
No - what BAS is suggesting is that the lamp fitting may have been designed with 12V in mind in regard to safety. So for example some 12V lighting systems string two bare wires across the room with 12V between them and you clip 12V bulbs between the wires. Trying to use mains on this would represent a hazard!
This is an extreme example and the inadequacies of the design of your lamp fitting may not be so obvious. I imagine it will have some writing on it somewhere specifying the permitted voltage.
G4 lampholders are not generally rated for 240V, modifying them to operate at 240V is really not an option, since there is nothing to then stop people putting 12V lamps in there and causing a fire/explosion.