I get gnats occasionally but not where it's really problematic. I have thrown yellow bananas in the fridge for a few days and they've kept ok without spoiling. If you find that your bananas are going brown faster than you can use them you can put the in the freezer peel and all and they will keep really well. I've been doing this for years and then just pull out the banana when I need it and let it thaw on the counter or in a bit of warm water, they peel protects the fruit perfectly.
I've seen infomercials for those "green bags" which are supposedly supposed to keep produce fresher longer. I've seen them put bananas in them, that might be a option since they are supposed to slow down the ripening process. I've not tried them, they are kinda pricey and we tend to eat produce fast enough in our house where that isn't an issue.
I don't know if I would recommend pouring veggie oil down your pipes to help with the gnats. Eventually the oil will coagulate and it might block your pipes, especially if you live in a home with older pipes (like me!). Mabye try pouring some baking soda and vinegar down instead? It'll help to clear out whatever food scraps are left in the drain that the gnats are looking for.