Dementia is not a disease you suddenly develop. All the types of dementia I am familiar with - Alzheimers, several forms of vascular dementia, dementia associated with Parkinsons, which probably accounts for 90% of all cases, are preceded by physical changes in the brain that have been taking place for years.
As your mother suffered from early onset dementia,I can understand that you will be very wary of any potential link between dementia and any other cause, but for someone to have been in hospital, they must have had a pre-existing illness and as TeacherAnne says when you are not feeling well lots of changes in your environment can be disordering and confusing. Hospitals, despite their intentions, are not restful places to be in. A constant bustle of movement, strange sounds and disturbed sleep.
When someone is the early stages of dementia. Often, while they are in their own home where ordinary life is a procession of lifetime habits, the small signs that that person is developing dementia can be missed. But if they face any trauma that leads to the disturbance of these habits, their inability to cope with change, is suddenly highlighted and it looks as if they have 'suddenly' developed dementia.
For my uncle, already diagnosed with mild dementia, his wife's hospital admission after a stroke and having carers coming into the home triggered his deterioration. He could not cope with the changes to his routine. As we discovered, she had been developing vascular dementia caused by tiny strokes for sometime, but seemed OK at home. The more severe stroke that led to her hospital admission also did enough brain damage for her to need care on discharge but it was the stroke , not the hospital admission that caused the problem