well to start its based on the fact hooman kills everyone on the hence the name betrayer but the reason why he has flowey motif's is mostly because of floweys close connection to the surface
UB happens during a soulless Pacifist, when after a Pacifist, you kill everything on the surface. Hence you are a traitor. Helping them to betray them all later, sort of what flowey does
after a long fight you finally hit sans... but wha'ts this? he isn't dead as sans gets back up he looks deeper into his soul and WITH THE POWER OF PATIENCE HES STILL KICKING AND STRIVES TO BEAT YOU DOWN WITH JUSTICE! but sans can last long with patience... after all its not D.T=)