The only way it could make sense is if Danger was exaggerating and became self-aware, or at least fully sapient, later than she'd suggested (which might be confusing to even her, as her digital memories would go back years, possibly
decades, farther than true self-awareness!). Through the vast majority of X-history, it was just a program. Only at the very end did it become self-aware, and quite possibly, Xavier *didn't notice,* and just got annoyed and tried to 'fix the code.' He's not an expert in AI or machine intelligence and for all her blather, telepathy didn't seem to affect her, so her sapience would be 'invisible' to his strongest sense.
That's how it seems to me. Xavier didn't really 100% understand the potential of the Shiar tech he was using, and didn't even know it was possible that it could 'evolve' into sapience, he certainly didn't think *he* had the ability to create true AI
by accident, since he's a smart dude, but hardly the world's top computer programmer! And so when the Danger Room 'acted up,' he 'fixed the code' to lock it back down, not realizing he was slamming the door on a newly 'born' conscious creature. Silly alien tech. Gotta get a Shiar computer expert in here as soon as I find the number for Shiar stolen stuff tech support.
Like any new life, Danger found any restrictions (even if they were lines of code, and not kiddy gates) to be unfair, and overreacted, like a toddler being hauled off to bedtime. She seems far better adjusted these days, working alongside Xavier's brood willingly, and is quite possibly a bit embarrassed by her earlier accusations.