Hmm, I haven't tried cutting the top for planting because the roots are on the bottom and once I planted them whole, roots usually grow within a week below. Plus, I have pill bugs which tends to eat anything with water including onions. No, onions won't repel pill bugs.
I have cut green onion, radish, carrots bottom from supermarket and replant them. The onion bottom dried up quickly here or be eaten by pill bugs.